結果

問題 No.709 優勝可能性
ユーザー htensaihtensai
提出日時 2020-01-08 08:19:19
言語 Java19
(openjdk 21)
結果
TLE  
実行時間 -
コード長 1,020 bytes
コンパイル時間 4,136 ms
コンパイル使用メモリ 75,908 KB
実行使用メモリ 56,132 KB
最終ジャッジ日時 2023-08-15 00:16:50
合計ジャッジ時間 14,228 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
55,984 KB
testcase_01 AC 125 ms
55,724 KB
testcase_02 AC 130 ms
55,776 KB
testcase_03 AC 128 ms
55,704 KB
testcase_04 AC 123 ms
55,796 KB
testcase_05 AC 133 ms
56,064 KB
testcase_06 AC 131 ms
56,132 KB
testcase_07 AC 123 ms
55,992 KB
testcase_08 AC 125 ms
56,064 KB
testcase_09 AC 129 ms
56,028 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.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        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++) {
            HashSet<Integer> count = new HashSet<>();
            for (int j = 0; j < m; j++) {
                int x = sc.nextInt();
                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