結果

問題 No.709 優勝可能性
ユーザー tentententen
提出日時 2022-08-12 08:38:47
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 1,754 bytes
コンパイル時間 2,645 ms
コンパイル使用メモリ 78,396 KB
実行使用メモリ 66,636 KB
最終ジャッジ日時 2023-10-23 19:07:04
合計ジャッジ時間 11,314 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 51 ms
36,560 KB
testcase_01 AC 52 ms
36,584 KB
testcase_02 AC 53 ms
36,540 KB
testcase_03 AC 53 ms
36,548 KB
testcase_04 AC 51 ms
36,532 KB
testcase_05 AC 51 ms
36,548 KB
testcase_06 AC 51 ms
36,552 KB
testcase_07 AC 51 ms
36,508 KB
testcase_08 AC 52 ms
36,524 KB
testcase_09 AC 51 ms
36,548 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.io.*;
import java.util.*;

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

class Scanner {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    
    public Scanner() throws Exception {
        
    }
    
    public int nextInt() throws Exception {
        return Integer.parseInt(next());
    }
    
    public long nextLong() throws Exception {
        return Long.parseLong(next());
    }
    
    public double nextDouble() throws Exception {
        return Double.parseDouble(next());
    }
    
    public String next() throws Exception {
        while (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
}
0