結果
| 問題 |
No.11 カードマッチ
|
| コンテスト | |
| ユーザー |
spacia
|
| 提出日時 | 2016-01-08 23:56:47 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 74 ms / 5,000 ms |
| コード長 | 930 bytes |
| コンパイル時間 | 2,193 ms |
| コンパイル使用メモリ | 77,440 KB |
| 実行使用メモリ | 41,852 KB |
| 最終ジャッジ日時 | 2024-10-11 20:00:24 |
| 合計ジャッジ時間 | 4,076 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 19 |
ソースコード
import java.io.*;
import java.util.*;
class Main {
public static void out (Object o) {
System.out.println(o);
}
public static void main (String[] args) throws IOException {
BufferedReader br =
new BufferedReader(new InputStreamReader(System.in));
int markCnt = Integer.parseInt(br.readLine());
int maxNum = Integer.parseInt(br.readLine());
int n = Integer.parseInt(br.readLine());
int[] marks = new int[markCnt + 1];
ArrayList<Integer> numList = new ArrayList<Integer>();
for (int i = 0; i < n; i++) {
String[] line = br.readLine().split(" ");
int mark = Integer.parseInt(line[0]);
int num = Integer.parseInt(line[1]);
marks[mark]++;
if (!numList.contains(num)) {
numList.add(num);
}
}
long ans = 0;
for (int i = 1; i <= markCnt; i++) {
if (marks[i] == 0) {
ans += numList.size();
} else {
ans += maxNum - marks[i];
}
}
out(ans);
}
}
spacia