結果

問題 No.11 カードマッチ
ユーザー dazydazy
提出日時 2017-11-28 04:10:41
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 4 ms / 5,000 ms
コード長 703 bytes
コンパイル時間 387 ms
コンパイル使用メモリ 51,728 KB
実行使用メモリ 5,556 KB
最終ジャッジ日時 2023-08-18 08:29:11
合計ジャッジ時間 1,329 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
5,396 KB
testcase_01 AC 3 ms
5,404 KB
testcase_02 AC 3 ms
5,352 KB
testcase_03 AC 3 ms
5,332 KB
testcase_04 AC 3 ms
5,396 KB
testcase_05 AC 4 ms
5,460 KB
testcase_06 AC 3 ms
5,308 KB
testcase_07 AC 3 ms
5,352 KB
testcase_08 AC 3 ms
5,404 KB
testcase_09 AC 3 ms
5,540 KB
testcase_10 AC 3 ms
5,396 KB
testcase_11 AC 3 ms
5,532 KB
testcase_12 AC 3 ms
5,348 KB
testcase_13 AC 3 ms
5,324 KB
testcase_14 AC 3 ms
5,324 KB
testcase_15 AC 3 ms
5,556 KB
testcase_16 AC 3 ms
5,400 KB
testcase_17 AC 3 ms
5,336 KB
testcase_18 AC 3 ms
5,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0