結果
問題 | No.11 カードマッチ |
ユーザー | rn4ru |
提出日時 | 2016-04-13 02:18:46 |
言語 | Java21 (openjdk 21) |
結果 |
MLE
|
実行時間 | - |
コード長 | 935 bytes |
コンパイル時間 | 2,192 ms |
コンパイル使用メモリ | 76,948 KB |
実行使用メモリ | 762,496 KB |
最終ジャッジ日時 | 2024-04-15 00:23:22 |
合計ジャッジ時間 | 13,769 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 135 ms
54,160 KB |
testcase_01 | AC | 131 ms
54,232 KB |
testcase_02 | AC | 133 ms
54,248 KB |
testcase_03 | AC | 131 ms
53,968 KB |
testcase_04 | MLE | - |
testcase_05 | AC | 129 ms
53,976 KB |
testcase_06 | MLE | - |
testcase_07 | MLE | - |
testcase_08 | MLE | - |
testcase_09 | MLE | - |
testcase_10 | MLE | - |
testcase_11 | MLE | - |
testcase_12 | MLE | - |
testcase_13 | MLE | - |
testcase_14 | MLE | - |
testcase_15 | AC | 227 ms
78,420 KB |
testcase_16 | AC | 633 ms
362,392 KB |
testcase_17 | AC | 325 ms
140,872 KB |
testcase_18 | AC | 971 ms
457,324 KB |
ソースコード
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int W = scanner.nextInt(); int H = scanner.nextInt(); int N = scanner.nextInt(); boolean[][] hands = new boolean[W + 1][H + 1]; boolean[][] covered = new boolean[W + 1][H + 1]; for (int i = 0; i < N; i++) { int S = scanner.nextInt(); int K = scanner.nextInt(); hands[S][K] = true; covered[S][K] = true; } long match = 0; for (int i = 1; i <= W; i++) { boolean found = false; for (int j = 1; j <= H; j++) { if (hands[i][j]) { found = true; for (int k = 1; k <= W; k++) { if (!covered[k][j]) { covered[k][j] = true; match++; } } } } if (!found) continue; for (int k = 1; k <= H; k++) { if (!covered[i][k]) { covered[i][k] = true; match++; } } } System.out.println(match); } }