結果
問題 | No.433 ICPC国内予選の選抜ルールがこんな感じだったらうれしい |
ユーザー | htensai |
提出日時 | 2020-05-12 10:25:56 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 1,323 ms / 4,000 ms |
コード長 | 1,963 bytes |
コンパイル時間 | 3,724 ms |
コンパイル使用メモリ | 80,324 KB |
実行使用メモリ | 87,164 KB |
最終ジャッジ日時 | 2024-07-23 20:35:10 |
合計ジャッジ時間 | 49,699 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1,253 ms
85,164 KB |
testcase_01 | AC | 1,308 ms
83,276 KB |
testcase_02 | AC | 1,167 ms
75,696 KB |
testcase_03 | AC | 1,150 ms
73,420 KB |
testcase_04 | AC | 1,197 ms
73,576 KB |
testcase_05 | AC | 1,247 ms
80,332 KB |
testcase_06 | AC | 1,217 ms
85,284 KB |
testcase_07 | AC | 1,323 ms
87,164 KB |
testcase_08 | AC | 1,262 ms
80,900 KB |
testcase_09 | AC | 1,135 ms
73,068 KB |
testcase_10 | AC | 1,084 ms
73,096 KB |
testcase_11 | AC | 1,093 ms
73,340 KB |
testcase_12 | AC | 1,098 ms
72,880 KB |
testcase_13 | AC | 1,044 ms
72,840 KB |
testcase_14 | AC | 1,070 ms
73,260 KB |
testcase_15 | AC | 1,092 ms
73,832 KB |
testcase_16 | AC | 1,018 ms
73,572 KB |
testcase_17 | AC | 1,138 ms
72,928 KB |
testcase_18 | AC | 1,109 ms
72,872 KB |
testcase_19 | AC | 1,036 ms
73,788 KB |
testcase_20 | AC | 1,057 ms
73,088 KB |
testcase_21 | AC | 1,077 ms
72,828 KB |
testcase_22 | AC | 1,103 ms
73,124 KB |
testcase_23 | AC | 1,089 ms
72,940 KB |
testcase_24 | AC | 1,061 ms
73,080 KB |
testcase_25 | AC | 1,080 ms
72,732 KB |
testcase_26 | AC | 1,064 ms
73,672 KB |
testcase_27 | AC | 1,095 ms
73,512 KB |
testcase_28 | AC | 1,104 ms
72,616 KB |
testcase_29 | AC | 1,074 ms
73,860 KB |
testcase_30 | AC | 135 ms
53,912 KB |
testcase_31 | AC | 121 ms
52,952 KB |
testcase_32 | AC | 1,066 ms
73,028 KB |
testcase_33 | AC | 1,117 ms
73,136 KB |
testcase_34 | AC | 1,109 ms
73,308 KB |
testcase_35 | AC | 138 ms
54,280 KB |
testcase_36 | AC | 136 ms
53,848 KB |
testcase_37 | AC | 159 ms
54,052 KB |
testcase_38 | AC | 164 ms
53,940 KB |
testcase_39 | AC | 220 ms
56,676 KB |
testcase_40 | AC | 215 ms
56,548 KB |
testcase_41 | AC | 397 ms
59,124 KB |
testcase_42 | AC | 394 ms
59,248 KB |
testcase_43 | AC | 391 ms
59,356 KB |
testcase_44 | AC | 387 ms
59,228 KB |
testcase_45 | AC | 213 ms
56,632 KB |
testcase_46 | AC | 400 ms
59,064 KB |
testcase_47 | AC | 420 ms
59,268 KB |
ソースコード
import java.util.*; public class Main { static int[] dp; public static void main (String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); HashMap<Integer, PriorityQueue<Team>> all = new HashMap<>(); for (int i = 0; i < n; i++) { Team t = new Team(i, sc.nextInt(), sc.nextInt(), sc.nextInt()); if (!all.containsKey(t.univ)) { all.put(t.univ, new PriorityQueue<>()); } all.get(t.univ).add(t); } PriorityQueue<Team> queue = new PriorityQueue<>(); for (PriorityQueue<Team> tmp : all.values()) { int idx = 0; while (tmp.size() > 0) { Team t = tmp.poll(); t.rank = idx; idx++; queue.add(t); } } StringBuilder sb = new StringBuilder(); for (int i = 0; i < k; i++) { sb.append(queue.poll().idx).append("\n"); } System.out.print(sb); } static int dfw(int x) { if (x < 10) { return x; } if (dp[x] != -1) { return dp[x]; } int prev = x % 10; x /= 10; int next = 0; while (x > 0) { int cur = x % 10; x /= 10; next *= 10; next += (prev + cur) % 10 + (prev + cur) / 10; prev = cur; } dp[x] = dfw(next); return dp[x]; } static class Team implements Comparable<Team> { int idx; int score; int penalty; int univ; int rank; public Team(int idx, int score, int penalty, int univ) { this.idx = idx; this.score = score; this.penalty = penalty; this.univ = univ; } public int compareTo(Team another) { if (score == another.score) { if (rank == another.rank) { return penalty - another.penalty; } else { return rank - another.rank; } } else { return another.score - score; } } } }