結果

問題 No.709 優勝可能性
ユーザー tenten
提出日時 2020-12-28 14:08:53
言語 Java
(openjdk 23)
結果
TLE  
実行時間 -
コード長 1,014 bytes
コンパイル時間 1,845 ms
コンパイル使用メモリ 79,292 KB
実行使用メモリ 54,216 KB
最終ジャッジ日時 2024-10-03 04:27:22
合計ジャッジ時間 8,767 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 2
other AC * 10 TLE * 1 -- * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] maxes = new int[m];
        ArrayList<HashSet<Integer>> tops = new ArrayList<>();
        for (int i = 0; i < m; i++) {
            tops.add(new HashSet<>());
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < n; i++) {
            HashSet<Integer> ans = new HashSet<>();
             for (int j = 0; j < m; j++) {
                int x = sc.nextInt();
                if (maxes[j] < x) {
                    maxes[j] = x;
                    tops.get(j).clear();
                    tops.get(j).add(i);
                } else if (maxes[j] == x) {
                    tops.get(j).add(i);
                }
                ans.addAll(tops.get(j));
            }
            sb.append(ans.size()).append("\n");
        }
        System.out.print(sb);
    }
}
0