結果
| 問題 |
No.1109 調の判定
|
| コンテスト | |
| ユーザー |
Strorkis
|
| 提出日時 | 2020-07-10 21:36:18 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 945 bytes |
| コンパイル時間 | 13,414 ms |
| コンパイル使用メモリ | 378,008 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-11 08:13:18 |
| 合計ジャッジ時間 | 15,319 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 43 |
ソースコード
fn main() {
let n: usize = {
let mut buf = String::new();
std::io::stdin().read_line(&mut buf).unwrap();
buf.trim_end().parse().unwrap()
};
let t: Vec<i32> = {
let mut buf = String::new();
std::io::stdin().read_line(&mut buf).unwrap();
let iter = buf.split_whitespace();
iter.map(|x| x.parse().unwrap()).collect()
};
let mut ans = -1;
for d in 0..12 {
let mut is_true = true;
for i in 0..n {
let mut is_included = false;
for j in vec![0, 2, 4, 5, 7, 9, 11] {
if t[i] == (d + j) % 12 {
is_included = true;
}
}
if !is_included {
is_true = false;
}
}
if is_true && ans < 0 {
ans = d;
} else if is_true {
ans = -1;
break;
}
}
println!("{}", ans);
}
Strorkis