結果
問題 | No.628 Tagの勢い |
ユーザー |
|
提出日時 | 2024-05-27 17:56:57 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 550 bytes |
コンパイル時間 | 15,112 ms |
コンパイル使用メモリ | 391,300 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-20 20:34:32 |
合計ジャッジ時間 | 16,142 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
ソースコード
use std::{collections::HashMap, io::Read};fn main() {let mut s = String::new();std::io::stdin().read_to_string(&mut s).ok();let s: Vec<_> = s.lines().skip(1).collect();let mut h = HashMap::new();s.chunks(3).for_each(|s| {let n: Vec<i32> =s[1].split_whitespace().flat_map(str::parse).collect();s[2].split_whitespace().for_each(|t| {*h.entry(t).or_insert(0) += n[1];});});let mut a: Vec<_> = h.iter().map(|(k, v)| (-v, k)).collect();a.sort();(0..10.min(a.len())).for_each(|i| println!("{} {}", a[i].1, -a[i].0));}