結果
| 問題 | No.628 Tagの勢い | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2018-01-06 12:46:01 | 
| 言語 | Java (openjdk 23) | 
| 結果 | 
                                RE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 1,432 bytes | 
| コンパイル時間 | 4,548 ms | 
| コンパイル使用メモリ | 80,520 KB | 
| 実行使用メモリ | 46,724 KB | 
| 最終ジャッジ日時 | 2024-10-07 22:19:31 | 
| 合計ジャッジ時間 | 7,275 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 14 RE * 5 | 
ソースコード
import java.io.*;
import java.util.*;
import java.util.Map.*;
public class Main_yukicoder628 {
	private static Scanner sc;
	private static Printer pr;
	private static void solve() {
		int n = sc.nextInt();
		Map<String, Integer> hm = new HashMap<>();
		for (int i = 0; i < n; i++) {
			@SuppressWarnings("unused")
			int no = sc.nextInt();
			int m = sc.nextInt();
			int s = sc.nextInt();
			for (int j = 0; j < m; j++) {
				String tag = sc.next();
				if (hm.containsKey(tag)) {
					hm.put(tag, hm.get(tag) + s);
				} else {
					hm.put(tag, s);
				}
			}
		}
		List<Pair> ans = new ArrayList<>();
		for (Entry<String, Integer> e : hm.entrySet()) {
			ans.add(new Pair(e.getKey(), e.getValue()));
		}
		Collections.sort(ans);
		for (int i = 0; i < 10; i++) {
			Pair e = ans.get(i);
			pr.printf("%s %d\n", e.a, e.b);
		}
	}
	private static class Pair implements Comparable<Pair> {
		String a;
		int b;
		Pair(String a, int b) {
			this.a = a;
			this.b = b;
		}
		@Override
		public int compareTo(Pair o) {
			if (b == o.b) {
				return a.compareTo(o.a);
			}
			return Integer.compare(o.b, b);
		}
	}
	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);
		solve();
		pr.close();
		sc.close();
	}
	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}
            
            
            
        