結果
| 問題 |
No.11 カードマッチ
|
| コンテスト | |
| ユーザー |
🍮かんプリン
|
| 提出日時 | 2019-04-26 14:13:58 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 1,113 bytes |
| コンパイル時間 | 643 ms |
| コンパイル使用メモリ | 78,216 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-24 07:28:46 |
| 合計ジャッジ時間 | 1,369 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 19 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <math.h>
#include <set>
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define P pair<int, int>
#define MOD 1000000007
#define INF 1012345678
#define NINF (-2147483647-1)
#define LLINF 9223372036854775807
using ll = long long;
using namespace std;
int main() {
int W, H, N;
cin >> W >> H >> N;
ll cnt = 0;
set<int> w, h;
for (int i = 0; i < N; i++)
{
int S, K;
cin >> S >> K;
if (w.find(S) == w.end() && h.find(K) == h.end()) {
cnt += H - 1 + W - 1 - h.size() - w.size();
w.insert(S);
h.insert(K);
}
else if (w.find(S) == w.end()) {
cnt += H - 1 - h.size();
w.insert(S);
}
else if (h.find(K) == h.end()) {
cnt += W - 1 - w.size();
h.insert(K);
}
else {
cnt--;
}
}
cout << cnt << endl;
getchar(); getchar();
return 0;
}
🍮かんプリン