結果
問題 | No.11 カードマッチ |
ユーザー | nenuon |
提出日時 | 2017-07-20 17:56:16 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 6 ms / 5,000 ms |
コード長 | 799 bytes |
コンパイル時間 | 1,010 ms |
コンパイル使用メモリ | 89,236 KB |
実行使用メモリ | 8,448 KB |
最終ジャッジ日時 | 2024-10-08 17:48:25 |
合計ジャッジ時間 | 2,045 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
ソースコード
#include <algorithm>#include <cstdio>#include <iostream>#include <map>#include <cmath>#include <queue>#include <set>#include <sstream>#include <stack>#include <string>#include <vector>#include <stdlib.h>#include <stdio.h>#include <bitset>using namespace std;#define FOR(I,A,B) for(int I = (A); I < (B); ++I)typedef long long ll;int t[1000006]; // マークが何回出たかbool is[1000006];int main(){FOR(i,0,1000006) {t[i] = 0;is[i] = false;}int W,H,N;cin >> W >> H >> N;int cnt = 0; // 出た数FOR(i,0,N) {int s, k;cin >> s >> k;t[s]++;if(!is[k]) cnt++;is[k] = true;}ll ans = 0;FOR(i,1,W+1) {if(t[i] == 0) {ans += cnt;} else {ans += H - t[i];}}cout << ans << endl;return 0;}