結果
問題 | No.628 Tagの勢い |
ユーザー | shinwisteria |
提出日時 | 2018-03-06 20:25:52 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 303 ms / 2,000 ms |
コード長 | 1,074 bytes |
コンパイル時間 | 4,000 ms |
コンパイル使用メモリ | 82,504 KB |
実行使用メモリ | 48,240 KB |
最終ジャッジ日時 | 2024-04-16 20:09:30 |
合計ジャッジ時間 | 8,368 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 154 ms
42,316 KB |
testcase_01 | AC | 148 ms
42,368 KB |
testcase_02 | AC | 162 ms
42,412 KB |
testcase_03 | AC | 165 ms
42,548 KB |
testcase_04 | AC | 156 ms
42,416 KB |
testcase_05 | AC | 144 ms
42,368 KB |
testcase_06 | AC | 165 ms
42,412 KB |
testcase_07 | AC | 168 ms
42,424 KB |
testcase_08 | AC | 171 ms
42,624 KB |
testcase_09 | AC | 166 ms
42,520 KB |
testcase_10 | AC | 182 ms
42,864 KB |
testcase_11 | AC | 174 ms
42,816 KB |
testcase_12 | AC | 301 ms
48,240 KB |
testcase_13 | AC | 303 ms
48,056 KB |
testcase_14 | AC | 300 ms
48,128 KB |
testcase_15 | AC | 301 ms
46,824 KB |
testcase_16 | AC | 274 ms
47,368 KB |
testcase_17 | AC | 164 ms
42,456 KB |
testcase_18 | AC | 161 ms
42,524 KB |
ソースコード
package m.shin; import java.util.Map.Entry; import java.util.Scanner; import java.util.TreeMap; public class Con628 { public static void main(String[] args) { Scanner s = new Scanner(System.in); int N = s.nextInt(); TreeMap<String , Integer> tag = new TreeMap<>(); for(int i = 0;i < N;i++){ s.nextInt(); int M = s.nextInt() , point = s.nextInt(); for(int j = 0;j < M;j++){ String str = s.next(); if(tag.get(str) == null){ tag.put(str, point); }else{ tag.put(str, tag.get(str)+point); } //System.out.println(str + " " + tag.get(str)); } } s.close(); int size = tag.size(); TreeMap<Integer , String> ans = new TreeMap<>(); for(int i = 0;i < size;i++){ Entry<String , Integer> ent = tag.pollFirstEntry(); int j = 9; while(ans.get(ent.getValue()*10 + j) != null){ j--; } ans.put(ent.getValue()*10 + j, ent.getKey()); } for(int i = 0;i < Math.min(size, 10);i++){ Entry<Integer , String> ent = ans.pollLastEntry(); System.out.println(ent.getValue() + " " + ent.getKey()/10); } } }