結果
問題 |
No.1032 数数え
|
ユーザー |
![]() |
提出日時 | 2020-04-23 15:27:47 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 21 ms / 2,000 ms |
コード長 | 615 bytes |
コンパイル時間 | 19,510 ms |
コンパイル使用メモリ | 377,884 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-13 15:14:15 |
合計ジャッジ時間 | 18,474 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
ソースコード
use std::io::Read; use std::io::Write; fn run() { let out = std::io::stdout(); let mut out = std::io::BufWriter::new(out.lock()); let mut s = String::new(); std::io::stdin().read_to_string(&mut s).unwrap(); let mut it = s.trim().split_whitespace(); it.next(); let m: usize = it.next().unwrap().parse().unwrap(); let mut cnt = vec![0; m + 1]; for s in it { let k: usize = s.parse().unwrap(); cnt.get_mut(k).map(|p| *p += 1); } for (i, c) in cnt.into_iter().enumerate().skip(1) { writeln!(out, "{} {}", i, c).ok(); } } fn main() { run(); }