結果
問題 | No.11 カードマッチ |
ユーザー | Flere0114 |
提出日時 | 2016-02-24 15:55:45 |
言語 | Java21 (openjdk 21) |
結果 |
MLE
|
実行時間 | - |
コード長 | 947 bytes |
コンパイル時間 | 3,779 ms |
コンパイル使用メモリ | 77,208 KB |
実行使用メモリ | 765,800 KB |
最終ジャッジ日時 | 2023-10-23 19:37:26 |
合計ジャッジ時間 | 15,023 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 126 ms
57,600 KB |
testcase_01 | AC | 125 ms
57,544 KB |
testcase_02 | AC | 123 ms
57,124 KB |
testcase_03 | AC | 120 ms
57,056 KB |
testcase_04 | MLE | - |
testcase_05 | AC | 618 ms
57,260 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 | 171 ms
69,564 KB |
testcase_16 | AC | 281 ms
195,460 KB |
testcase_17 | AC | 220 ms
116,260 KB |
testcase_18 | AC | 332 ms
255,008 KB |
ソースコード
import java.util.Scanner; public class No11 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int w, h, n; long ans = 0; w = sc.nextInt(); h = sc.nextInt(); n = sc.nextInt(); int[] s = new int[n], k = new int[n]; boolean[][] po = new boolean[w][h]; for (int i = 0; i < n; i++) { s[i] = sc.nextInt() - 1; k[i] = sc.nextInt() - 1; po[s[i]][k[i]] = true; } for (int i = 0; i < n; i++) { for (int j = 0; j < h; j++) { if(!po[s[i]][j]){ ans++; po[s[i]][j] = true; } } for (int j = 0; j < w; j++) { if(!po[j][k[i]]){ ans++; po[j][k[i]] = true; } } } System.out.println(ans); } }