結果
問題 |
No.709 優勝可能性
|
ユーザー |
![]() |
提出日時 | 2020-12-28 14:07:15 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,014 bytes |
コンパイル時間 | 2,401 ms |
コンパイル使用メモリ | 79,556 KB |
実行使用メモリ | 70,136 KB |
最終ジャッジ日時 | 2024-10-03 04:26:06 |
合計ジャッジ時間 | 20,035 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 2 |
other | WA * 22 |
ソースコード
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); } }