結果
| 問題 | No.406 鴨等間隔の法則 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-10-13 09:03:35 |
| 言語 | Rust (1.97.1 + proconio + num + itertools + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 8 ms / 2,000 ms |
| + 33µs | |
| コード長 | 414 bytes |
| 記録 | |
| コンパイル時間 | 10,897 ms |
| コンパイル使用メモリ | 191,480 KB |
| 実行使用メモリ | 9,800 KB |
| 最終ジャッジ日時 | 2026-10-13 09:03:54 |
| 合計ジャッジ時間 | 8,237 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
コンパイルメッセージ
warning: unnecessary parentheses around `for` iterator expression
--> src/main.rs:7:14
|
7 | for i in (0..n){
| ^ ^
|
= note: `#[warn(unused_parens)]` (part of `#[warn(unused)]`) on by default
help: remove these parentheses
|
7 - for i in (0..n){
7 + for i in 0..n {
|
warning: unnecessary parentheses around `for` iterator expression
--> src/main.rs:15:14
|
15 | for i in (1..n){
| ^ ^
|
help: remove these parentheses
|
15 - for i in (1..n){
15 + for i in 1..n {
|
warning: unused variable: `i`
--> src/main.rs:7:9
|
7 | for i in (0..n){
| ^ help: if this is intentional, prefix it with an underscore: `_i`
|
= note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default
ソースコード
use proconio::input;
fn main(){
input!{
n:usize,
}
let mut vec:Vec <usize>=Vec::new();
for i in (0..n){
input!{
c:usize,
}
vec.push(c);
}
vec.sort();
let mut ans="YES";
for i in (1..n){
if vec[1]-vec[0]!=vec[i]-vec[i-1]{
ans="NO";
}
}
if vec[0]==vec[1]{
ans="NO";
}
print!("{}",ans);
}