結果
| 問題 | No.11 カードマッチ | 
| コンテスト | |
| ユーザー |  dazy | 
| 提出日時 | 2017-11-28 04:10:41 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 3 ms / 5,000 ms | 
| コード長 | 703 bytes | 
| コンパイル時間 | 409 ms | 
| コンパイル使用メモリ | 53,592 KB | 
| 実行使用メモリ | 5,504 KB | 
| 最終ジャッジ日時 | 2024-11-27 12:16:24 | 
| 合計ジャッジ時間 | 1,192 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 19 | 
ソースコード
#include <iostream>
using namespace std;
#define fastcin {\
    cin.tie(0);\
    ios::sync_with_stdio(false);\
}
#define REP(i, a) for(int i = 0; i < a; i++)
#define scan(x) cin >> x
#define print(x) cout << x << "\n"
typedef long long ll;
int main() {
    fastcin;
    int W, H;
    ll N;
    scan(W); scan(H); scan(N);
    bool wl[1000001] = {}, hl[1000001] = {};
    int wa = 0, ha = 0;
    ll ans;
    REP(i, N) {
        int s, k;
        cin >> s >> k;
        if (!wl[s]) {
            wa++;
            wl[s] = true;
        } else ;
        if (!hl[k]) {
            ha++;
            hl[k] = true;
        } else ;
    }
    ans = wa*H + ha*W - N - wa*ha;
    print(ans);
    return 0;
}
            
            
            
        