結果
| 問題 | No.11 カードマッチ | 
| コンテスト | |
| ユーザー |  holeguma | 
| 提出日時 | 2015-08-07 11:33:23 | 
| 言語 | Java (openjdk 23) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 847 bytes | 
| コンパイル時間 | 2,376 ms | 
| コンパイル使用メモリ | 77,996 KB | 
| 実行使用メモリ | 58,772 KB | 
| 最終ジャッジ日時 | 2024-07-18 03:53:00 | 
| 合計ジャッジ時間 | 4,724 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | WA * 19 | 
ソースコード
import java.io.*;
import java.util.HashMap;
class Main{
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null){
int w=Integer.parseInt(line);
int h=Integer.parseInt(br.readLine());
int cnt=0;
int matchcnt=0;
int[] app=new int[h+1];
HashMap<Integer,Integer> dic=new HashMap<Integer,Integer>();
int n=Integer.parseInt(br.readLine());
for(int i=0;i<n;i++){
line=br.readLine();
String[] values=line.split(" ");
int s=Integer.parseInt(values[0]);
int k=Integer.parseInt(values[1]);
if(!dic.containsKey(s)){
dic.put(s,1);
}
else{
dic.put(s,dic.get(s)+1);
}
if(app[k]==0){
app[k]=1;
cnt++;
}
}
for(int i=0;i<=w;i++){
if(dic.containsKey(i)){
matchcnt+=h-dic.get(i);
}
else{
matchcnt+=cnt;
}
}
System.out.println(matchcnt);
}
}
}
            
            
            
        