結果
問題 | No.11 カードマッチ |
ユーザー | k_kadora |
提出日時 | 2015-06-15 15:49:41 |
言語 | Java19 (openjdk 21) |
結果 |
AC
|
実行時間 | 144 ms / 5,000 ms |
コード長 | 608 bytes |
コンパイル時間 | 4,439 ms |
コンパイル使用メモリ | 72,632 KB |
実行使用メモリ | 62,124 KB |
最終ジャッジ日時 | 2023-08-02 00:08:33 |
合計ジャッジ時間 | 6,784 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 120 ms
55,696 KB |
testcase_01 | AC | 121 ms
55,432 KB |
testcase_02 | AC | 121 ms
55,528 KB |
testcase_03 | AC | 120 ms
55,420 KB |
testcase_04 | AC | 138 ms
57,804 KB |
testcase_05 | AC | 120 ms
55,872 KB |
testcase_06 | AC | 137 ms
61,544 KB |
testcase_07 | AC | 142 ms
58,156 KB |
testcase_08 | AC | 144 ms
58,436 KB |
testcase_09 | AC | 144 ms
62,124 KB |
testcase_10 | AC | 141 ms
60,248 KB |
testcase_11 | AC | 144 ms
60,328 KB |
testcase_12 | AC | 138 ms
60,248 KB |
testcase_13 | AC | 143 ms
60,384 KB |
testcase_14 | AC | 143 ms
60,312 KB |
testcase_15 | AC | 138 ms
55,656 KB |
testcase_16 | AC | 138 ms
55,664 KB |
testcase_17 | AC | 137 ms
55,652 KB |
testcase_18 | AC | 139 ms
55,760 KB |
ソースコード
import java.util.Scanner; public class Yuki11{ public static void main(String[] arg){ Scanner sc = new Scanner(System.in); long tempw=0,temph=0,res; int w,h,n,temps,tempk; w = sc.nextInt(); h = sc.nextInt(); n = sc.nextInt(); int[] cs = new int[w]; int[] ck = new int[h]; for(int i = 0;i<n;i++){ temps = sc.nextInt()-1; tempk = sc.nextInt()-1; if(cs[temps] == 0){ cs[temps] = 1; tempw++; } if(ck[tempk] == 0){ ck[tempk] = 1; temph++; } } res = (long)h*(long)tempw+(long)w*(long)temph-(long)tempw*(long)temph-(long)n; System.out.println(res); } }