結果

問題 No.11 カードマッチ
ユーザー holegumaholeguma
提出日時 2015-08-07 11:33:23
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 847 bytes
コンパイル時間 2,207 ms
コンパイル使用メモリ 74,376 KB
実行使用メモリ 59,468 KB
最終ジャッジ日時 2023-09-25 04:29:16
合計ジャッジ時間 4,470 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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);
}
}
}
0