結果
| 問題 |
No.11 カードマッチ
|
| コンテスト | |
| ユーザー |
めうめう🎒
|
| 提出日時 | 2016-03-30 10:12:07 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 8 ms / 5,000 ms |
| コード長 | 845 bytes |
| コンパイル時間 | 990 ms |
| コンパイル使用メモリ | 73,176 KB |
| 実行使用メモリ | 7,808 KB |
| 最終ジャッジ日時 | 2024-10-11 20:03:04 |
| 合計ジャッジ時間 | 1,351 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 19 |
ソースコード
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define INF (1 << 30)
#define INFLL (1LL << 60)
int card_mark[1000010] = {};
bool used_mark[1000010] = {};
bool used_num[1000010] = {};
int main() {
ll w,h,n,s,k;
cin >> w >> h >> n;
for(int i = 0;i < w;i++){
card_mark[i] = h;
}
for(int i = 0;i < n;i++){
cin >> s >> k;
s--,k--;
card_mark[s]--;
used_mark[s] = true;
used_num[k] = true;
}
ll ans = 0,ans2 = 0,memo = 0;
for(int i = 0;i < h;i++){
if(used_num[i]) memo++;
}
for(int i = 0;i < w;i++){
if(card_mark[i] != h) ans += card_mark[i];
if(used_mark[i]) continue;
ans2 += memo;
}
cout << ans + ans2 << endl;
return 0;
}
めうめう🎒