結果

問題 No.2153 何コーダーが何人?
ユーザー mo124121mo124121
提出日時 2022-11-25 06:43:13
言語 Rust
(1.77.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 896 bytes
コンパイル時間 1,298 ms
コンパイル使用メモリ 182,760 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-17 13:00:37
合計ジャッジ時間 2,173 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 1 ms
6,944 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 1 ms
6,944 KB
testcase_08 AC 1 ms
6,940 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 1 ms
6,940 KB
testcase_11 AC 2 ms
6,944 KB
testcase_12 AC 1 ms
6,944 KB
testcase_13 AC 1 ms
6,940 KB
testcase_14 AC 1 ms
6,944 KB
testcase_15 AC 1 ms
6,944 KB
testcase_16 AC 2 ms
6,944 KB
testcase_17 AC 1 ms
6,940 KB
testcase_18 AC 2 ms
6,940 KB
testcase_19 AC 1 ms
6,940 KB
testcase_20 AC 0 ms
6,944 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unused variable: `i`
  --> 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`
  --> main.rs:29:10
   |
29 |     for (key, value) in color.iter() {
   |          ^^^ help: if this is intentional, prefix it with an underscore: `_key`

warning: 2 warnings emitted

ソースコード

diff #

#![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);
    }
}
0