結果

問題 No.709 優勝可能性
ユーザー htensaihtensai
提出日時 2020-01-08 08:25:38
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 1,244 bytes
コンパイル時間 2,534 ms
コンパイル使用メモリ 75,496 KB
実行使用メモリ 49,740 KB
最終ジャッジ日時 2023-08-15 00:17:08
合計ジャッジ時間 8,902 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
49,412 KB
testcase_01 AC 42 ms
49,604 KB
testcase_02 AC 41 ms
49,236 KB
testcase_03 AC 42 ms
49,420 KB
testcase_04 AC 41 ms
49,272 KB
testcase_05 AC 42 ms
49,740 KB
testcase_06 AC 42 ms
49,284 KB
testcase_07 AC 42 ms
49,316 KB
testcase_08 AC 41 ms
49,592 KB
testcase_09 AC 43 ms
49,252 KB
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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];
        for (int i = 0; i < m; i++) {
            maxIdxes[i] = new HashSet<Integer>();
        }
        int[] maxValues = new int[m];
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < n; i++) {
            String[] line = br.readLine().split(" ", m);
            HashSet<Integer> count = new HashSet<>();
            for (int j = 0; j < m; j++) {
                int x = Integer.parseInt(line[j]);
                if (maxValues[j] < x) {
                    maxValues[j] = x;
                    maxIdxes[j].clear();
                    maxIdxes[j].add(i);
                } else if (maxValues[j] == x) {
                    maxIdxes[j].add(i);
                }
                count.addAll(maxIdxes[j]);
            }
            sb.append(count.size()).append("\n");
        }
        System.out.print(sb);
    }
}
0