Skip to content

Instantly share code, notes, and snippets.

View yammmt's full-sized avatar
🗻
🗻

yammmt

🗻
🗻
View GitHub Profile
@yammmt
yammmt / runall.rb
Created February 25, 2024 05:00
AHC030 の `tools` に入っていたテストケースを雑に全実行
# frozen_string_literal: true
0..100.times do |i|
puts i
system('rm -f out.txt')
system("./target/release/tester ./a < in/#{sprintf('%04d', i)}.txt > out.txt")
system('head -1 out.txt')
end
@yammmt
yammmt / README.md
Last active January 17, 2024 11:36

数学がわからなくてもなんとか誤魔化して通す方法

考えたこと

回転と平行移動を同時に考えることは難しいので, とりあえずどちらかを先に考えることとする.

とりあえず, 今回の問題にて特徴的である右目左目の制約 (同じ $y$ 座標を有す) を考える. 回転角度さえわかれば, 平行移動の量を求めるには, 今の座標にかかっている回転を打ち消してから, 右目左目の中心点を原点に動かすだけの量を考えればよいな,

@yammmt
yammmt / Cargo.lock
Last active February 19, 2022 03:26
cargo-atcoder で PetGraph クレートを使える状態の Cargo.lock ファイル
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
name = "autocfg"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
[[package]]
name = "either"
@yammmt
yammmt / rust_virtual_contests.md
Last active December 25, 2023 11:34
cargo-compete で AtCoder Problem の Virtual Contest に出る

Rust でバチャに出たい

cargo-compete の README を読みつつ進める.

cargo-compete をインストールする

cargo install cargo-compete コマンドを実行する. AtCoder に合わせた Rust 1.42.0 では cargo-compete のビルドに失敗するので, おとなしく最近の Rust を使う.

compete.toml ファイルを正す

@yammmt
yammmt / bench_set.rb
Last active December 22, 2021 11:48
Benchmark of Ruby `Set`/`Array`
require 'benchmark'
require 'set'
ARRAY_SIZE = 1_000_000
a_values = (0..ARRAY_SIZE).to_a.shuffle
b_values = (0..ARRAY_SIZE).to_a.shuffle
Benchmark.bm 20 do |r|
s = Set.new
@yammmt
yammmt / 084.rs
Last active July 6, 2021 10:22
競プロ典型 90 問 (084) 両端キューで位置を調べる解法
use proconio::input;
use proconio::marker::Chars;
use std::collections::VecDeque;
fn main() {
input! {
n: u64,
s: Chars,
}
@yammmt
yammmt / main.rs
Created January 4, 2021 09:46
(Rust) test from another file
#[cfg(test)]
mod tests;
fn main() {
println!("Hello, world!");
}
fn one_p_one() -> u16 {
2
}
@yammmt
yammmt / not_panic.rs
Last active June 4, 2020 10:56
Failed to test panic with Rayon crate
use std::sync::mpsc;
use std::thread;
#[derive(Debug)]
enum ThreadMessage {
Hello,
Close,
Panic,
}
@yammmt
yammmt / thread_close.rs
Created June 3, 2020 11:35
close interactive rayon thread safely
use std::time::{Duration, SystemTime};
use std::sync::mpsc;
use std::thread;
#[derive(Debug)]
enum ThreadMessage {
Hello,
Close,
}