結果

問題 No.11 カードマッチ
ユーザー kyunakyuna
提出日時 2019-08-19 08:49:12
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 576 bytes
コンパイル時間 742 ms
コンパイル使用メモリ 77,304 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-10 07:09:01
合計ジャッジ時間 1,568 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 1 ms
6,948 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 2 ms
6,940 KB
testcase_12 AC 2 ms
6,940 KB
testcase_13 AC 2 ms
6,944 KB
testcase_14 AC 1 ms
6,944 KB
testcase_15 AC 2 ms
6,940 KB
testcase_16 AC 2 ms
6,940 KB
testcase_17 AC 1 ms
6,944 KB
testcase_18 AC 2 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

template <typename T>
vector<T> uni(vector<T> v) {
    sort(v.begin(), v.end());
    v.erase(unique(v.begin(), v.end()), v.end());
    return v;
}

int main() {
    long long w, h, n; cin >> w >> h >> n;
    vector<int> s(n), k(n);
    for (int i = 0; i < n; i++) cin >> s[i] >> k[i];
    long long cnt_s = uni(s).size();
    long long cnt_k = uni(k).size();
    long long unmatch = (w - cnt_s) * (h - cnt_k);
    long long match = w * h - unmatch;
    cout << match - n << endl;
    return 0;
}
0