結果
問題 | No.1032 数数え |
ユーザー |
|
提出日時 | 2024-06-03 16:53:38 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 45 ms / 2,000 ms |
コード長 | 450 bytes |
コンパイル時間 | 14,651 ms |
コンパイル使用メモリ | 379,116 KB |
実行使用メモリ | 7,552 KB |
最終ジャッジ日時 | 2024-12-23 10:39:05 |
合計ジャッジ時間 | 15,784 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
ソースコード
use std::{ collections::HashMap, io::{stdout, BufWriter, Read, Write}, }; fn main() { let mut s = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let v: Vec<u32> = s.split_whitespace().flat_map(str::parse).collect(); let mut h = HashMap::new(); for &l in &v[2..] { *h.entry(l).or_insert(0) += 1; } let mut w = BufWriter::new(stdout()); (1..=v[1]) .for_each(|i| writeln!(w, "{} {}", i, h.get(&i).unwrap_or(&0)).unwrap()) }