結果
問題 |
No.1468 Colourful Pastel
|
ユーザー |
|
提出日時 | 2024-06-20 18:51:23 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 15 ms / 1,000 ms |
コード長 | 458 bytes |
コンパイル時間 | 12,057 ms |
コンパイル使用メモリ | 403,852 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-20 18:51:39 |
合計ジャッジ時間 | 14,113 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
use std::{collections::HashMap, io::Read}; fn main() { let mut s = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let mut p = s.split_whitespace(); let n: usize = p.next().unwrap().parse().unwrap(); let mut h = HashMap::new(); let mut i = 0; for p in p.rev() { i += 1; let c = h.entry(p).or_insert(0); if i < n { *h.entry(p).or_insert(0) += 1; continue; } *c -= 1; if *c < 0 { println!("{}", p); break; } } }