結果
| 問題 |
No.1373 Directed Operations
|
| コンテスト | |
| ユーザー |
BrightLight
|
| 提出日時 | 2021-02-05 22:50:42 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 676 bytes |
| コンパイル時間 | 13,072 ms |
| コンパイル使用メモリ | 377,416 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-02 13:39:42 |
| 合計ジャッジ時間 | 15,010 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 2 |
| other | WA * 19 |
ソースコード
fn main() {
let n: usize = read();
let a: Vec<usize> = read_vec();
let mut v: Vec<usize> = vec![0; n - 1];
for i in 0..n - 1 {
v[a[i] - 1] += 1;
}
let mut ans: String = "Yes".to_string();
for i in 0..n - 1 {
if v[n - i - 2] > i + 1 {
ans = "No".to_string();
break;
}
}
println!("{}", ans);
}
fn read<T: std::str::FromStr>() -> T {
let mut s = String::new();
std::io::stdin().read_line(&mut s).ok();
s.trim().parse().ok().unwrap()
}
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
read::<String>().split_whitespace()
.map(|e| e.parse().ok().unwrap()).collect()
}
BrightLight