結果
問題 | No.709 優勝可能性 |
ユーザー | htensai |
提出日時 | 2020-01-29 09:11:18 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 845 ms / 3,500 ms |
コード長 | 1,664 bytes |
コンパイル時間 | 2,084 ms |
コンパイル使用メモリ | 75,116 KB |
実行使用メモリ | 115,212 KB |
最終ジャッジ日時 | 2023-10-14 00:16:33 |
合計ジャッジ時間 | 12,048 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 44 ms
49,224 KB |
testcase_01 | AC | 44 ms
49,548 KB |
testcase_02 | AC | 43 ms
49,348 KB |
testcase_03 | AC | 43 ms
49,372 KB |
testcase_04 | AC | 43 ms
49,556 KB |
testcase_05 | AC | 44 ms
49,140 KB |
testcase_06 | AC | 43 ms
49,164 KB |
testcase_07 | AC | 44 ms
49,340 KB |
testcase_08 | AC | 45 ms
49,348 KB |
testcase_09 | AC | 44 ms
49,152 KB |
testcase_10 | AC | 375 ms
58,048 KB |
testcase_11 | AC | 227 ms
55,912 KB |
testcase_12 | AC | 490 ms
60,892 KB |
testcase_13 | AC | 524 ms
62,260 KB |
testcase_14 | AC | 537 ms
60,972 KB |
testcase_15 | AC | 518 ms
61,892 KB |
testcase_16 | AC | 630 ms
67,736 KB |
testcase_17 | AC | 845 ms
115,212 KB |
testcase_18 | AC | 43 ms
49,276 KB |
testcase_19 | AC | 44 ms
49,220 KB |
testcase_20 | AC | 593 ms
59,556 KB |
testcase_21 | AC | 567 ms
59,600 KB |
testcase_22 | AC | 44 ms
49,212 KB |
testcase_23 | AC | 44 ms
49,448 KB |
ソースコード
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] first = br.readLine().split(" ", 2); int n = Integer.parseInt(first[0]); int m = Integer.parseInt(first[1]); HashSet<Integer>[] maxIdxes = new HashSet[m]; int[] counts = new int[n]; for (int i = 0; i < m; i++) { maxIdxes[i] = new HashSet<Integer>(); } int ans = 0; int[] maxValues = new int[m]; StringBuilder sb = new StringBuilder(); for (int i = 0; i < n; i++) { String[] line = br.readLine().split(" ", m); for (int j = 0; j < m; j++) { int x = Integer.parseInt(line[j]); if (maxValues[j] < x) { maxValues[j] = x; for (int y : maxIdxes[j]) { counts[y]--; if (counts[y] == 0) { ans--; } } maxIdxes[j].clear(); maxIdxes[j].add(i); counts[i]++; if (counts[i] == 1) { ans++; } } else if (maxValues[j] == x) { maxIdxes[j].add(i); counts[i]++; if (counts[i] == 1) { ans++; } } } sb.append(ans).append("\n"); } System.out.print(sb); } }