結果
| 問題 |
No.406 鴨等間隔の法則
|
| ユーザー |
cra77756176
|
| 提出日時 | 2022-12-07 23:10:13 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 12 ms / 2,000 ms |
| コード長 | 514 bytes |
| コンパイル時間 | 13,471 ms |
| コンパイル使用メモリ | 375,908 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-14 02:32:32 |
| 合計ジャッジ時間 | 15,629 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
use std::collections::HashSet;
fn main() {
let mut xx = String::new();
std::io::Read::read_to_string(&mut std::io::stdin(), &mut xx).ok();
let mut xx: Vec<u64> = xx
.split_whitespace()
.skip(1)
.map(|n| n.parse().unwrap())
.collect();
xx.sort_unstable();
let distances: HashSet<u64> = xx.windows(2).map(|x| x[1] - x[0]).collect();
if distances.len() == 1 && !distances.contains(&0) {
println!("YES");
} else {
println!("NO");
}
}
cra77756176