結果
| 問題 | No.135 とりあえず1次元の問題 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-04 11:22:07 |
| 言語 | Rust (1.94.0 + proconio + num + itertools) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 5,000 ms |
| + 558µs | |
| コード長 | 567 bytes |
| 記録 | |
| コンパイル時間 | 817 ms |
| コンパイル使用メモリ | 185,168 KB |
| 実行使用メモリ | 5,888 KB |
| 最終ジャッジ日時 | 2026-08-04 15:20:17 |
| 合計ジャッジ時間 | 2,981 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 22 |
ソースコード
use std::io::*;
fn main() {
let mut s: String = String::new();
std::io::stdin().read_to_string(&mut s).ok();
let mut itr = s.trim().split_whitespace();
let n: usize = itr.next().unwrap().parse().unwrap();
let mut a: Vec<usize> = (0..n)
.map(|_| itr.next().unwrap().parse().unwrap())
.collect();
a.sort();
a.dedup();
if a.len() < 2 {
println!("0");
return;
}
let mut ans = 1 << 30;
for i in 0..a.len() - 1 {
ans = std::cmp::min(ans, a[i + 1] - a[i]);
}
println!("{}", ans);
}