結果
| 問題 | No.11 カードマッチ |
| コンテスト | |
| ユーザー |
chiho_miyako
|
| 提出日時 | 2015-04-16 13:48:38 |
| 言語 | Java (openjdk 25.0.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 742 bytes |
| 記録 | |
| コンパイル時間 | 2,041 ms |
| コンパイル使用メモリ | 75,204 KB |
| 実行使用メモリ | 42,164 KB |
| 最終ジャッジ日時 | 2024-07-04 14:54:13 |
| 合計ジャッジ時間 | 5,257 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 5 WA * 14 |
ソースコード
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
Scanner koko = new Scanner(System.in);
int w = koko.nextInt();
int h = koko.nextInt();
int n = koko.nextInt();
int[] s = new int[n];
int[] k = new int[n];
for(int i=0; i<n; i++){
s[i]=koko.nextInt();
k[i]=koko.nextInt();
}
Arrays.sort(s);
Arrays.sort(k);
int counts=1;
int countk=1;
for(int i=1; i<n; i++){
if(s[i]!=s[i-1]){
counts++;
}else if(k[i]!=k[i-1]){
countk++;
}
}
long ans=countk*w-n+counts*(h-countk);
System.out.println(ans);
}
}
chiho_miyako