結果

問題 No.2590 100000 Days of Christmas
ユーザー neko_the_shadowneko_the_shadow
提出日時 2024-01-26 12:37:19
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 542 bytes
コンパイル時間 9,472 ms
コンパイル使用メモリ 175,580 KB
実行使用メモリ 11,392 KB
最終ジャッジ日時 2024-01-26 12:37:33
合計ジャッジ時間 13,300 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,676 KB
testcase_01 AC 1 ms
6,676 KB
testcase_02 AC 1 ms
6,676 KB
testcase_03 AC 1 ms
6,676 KB
testcase_04 AC 1 ms
6,676 KB
testcase_05 AC 1 ms
6,676 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 1 ms
6,676 KB
testcase_11 AC 1 ms
6,676 KB
testcase_12 AC 0 ms
6,676 KB
testcase_13 WA -
testcase_14 AC 0 ms
6,676 KB
testcase_15 AC 1 ms
6,676 KB
testcase_16 AC 1 ms
6,676 KB
testcase_17 AC 1 ms
6,676 KB
testcase_18 AC 1 ms
6,676 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::{collections::HashMap, io};

fn main() {
    let mut map = HashMap::new();

    let n = read_line().parse::<i32>().unwrap();
    for i in 0..n {
        let s = read_line();
        *map.entry(s).or_insert(0) += (i + 1) * (n - i);
    }

    let mut entries = map.iter().collect::<Vec<_>>();
    entries.sort_by_key(|t| t.0);
    for (k, v) in entries {
        println!("{} {}", v, k)
    }
}

fn read_line() -> String {
    let mut line = String::new();
    io::stdin().read_line(&mut line).unwrap();
    line.trim().to_string()
}
0