結果

問題 No.11 カードマッチ
ユーザー nukachanukacha
提出日時 2017-05-22 22:38:36
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 5 ms / 5,000 ms
コード長 731 bytes
コンパイル時間 889 ms
コンパイル使用メモリ 78,828 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-19 14:13:48
合計ジャッジ時間 1,716 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>

int main()
{
    long long W, H;
    long long sc, kc;
    long long N;
    long long r;
    std::vector<int> S, K;
    std::vector<bool> has_s, has_k;
    std::cin >> W >> H >> N;
    S.resize(N);
    K.resize(N);
    for (long long i = 0; i < N; i++) {
        std::cin >> S[i] >> K[i];
    }
    has_s.resize(W, false);
    has_k.resize(H, false);
    for (long long i = 0; i < N; i++) {
       has_s[S[i] - 1] = true;
       has_k[K[i] - 1] = true;
    }
    sc = std::count(has_s.begin(), has_s.end(), true);
    kc = std::count(has_k.begin(), has_k.end(), true);
    r = sc * H + kc * W - sc * kc - N;
    std::cout << r << std::endl;
} 
0