結果
| 問題 |
No.2153 何コーダーが何人?
|
| コンテスト | |
| ユーザー |
mo124121
|
| 提出日時 | 2022-11-25 06:43:13 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 896 bytes |
| コンパイル時間 | 12,482 ms |
| コンパイル使用メモリ | 401,472 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-09 07:02:00 |
| 合計ジャッジ時間 | 13,464 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 19 |
コンパイルメッセージ
warning: unused variable: `i`
--> src/main.rs:14:9
|
14 | for i in 0..N {
| ^ help: if this is intentional, prefix it with an underscore: `_i`
|
= note: `#[warn(unused_variables)]` on by default
warning: unused variable: `key`
--> src/main.rs:29:10
|
29 | for (key, value) in color.iter() {
| ^^^ help: if this is intentional, prefix it with an underscore: `_key`
ソースコード
#![allow(clippy::let_unit_value)]
#![allow(non_snake_case)]
use std::{collections::HashMap, io::stdin, iter::zip};
fn main() {
let mut buf = String::new();
stdin().read_line(&mut buf).ok();
let N = buf.trim().parse().ok().unwrap();
let mut C = Vec::new();
let mut S = Vec::new();
let mut color: HashMap<String, usize> = HashMap::new();
for i in 0..N {
let mut buf = String::new();
stdin().read_line(&mut buf).unwrap();
let mut iter = buf.split_whitespace();
let s = iter.next().unwrap().to_string();
let c = iter.next().unwrap().parse::<usize>().unwrap();
S.push(s);
C.push(c);
}
for (s, c) in zip(S, C) {
color.insert(s, c);
}
let mut ans = vec![0_i32; 8];
for (key, value) in color.iter() {
ans[*value] += 1;
}
for a in ans {
println!("{}", a);
}
}
mo124121