結果
問題 | No.2153 何コーダーが何人? |
ユーザー |
|
提出日時 | 2024-05-08 11:21:49 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 571 bytes |
コンパイル時間 | 13,269 ms |
コンパイル使用メモリ | 400,476 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-14 15:00:56 |
合計ジャッジ時間 | 14,690 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 19 |
ソースコード
use std::{collections::{HashMap, HashSet},io::Read,};fn main() {let mut s = String::new();std::io::stdin().read_to_string(&mut s).ok();let i: Vec<_> = s.trim().split('\n').skip(1).collect();let mut set = HashSet::new();let mut m: HashMap<_, u32> = HashMap::new();for r in i.iter().rev() {let mut r = r.split_whitespace();let s = r.next().unwrap();let c: u8 = r.next().unwrap().parse().unwrap();if !set.contains(s) {set.insert(s);*m.entry(c).or_default() += 1;}}(0..8).for_each(|i| println!("{}", m.entry(i).or_default()));}