結果

問題 No.11 カードマッチ
ユーザー  nemunemu nemunemu
提出日時 2023-05-01 09:40:55
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 962 bytes
コンパイル時間 1,105 ms
コンパイル使用メモリ 79,132 KB
実行使用メモリ 814,272 KB
最終ジャッジ日時 2024-04-30 14:24:13
合計ジャッジ時間 2,173 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;

int main(){
    ll W, H, N;
    cin >> W >> H >> N;
    vector<ll> S(N), K(N);
    vector<vector<bool>> table(W, vector<bool>(H, false));
    for (int i = 0; i < N; ++i) {
        cin >> S[i] >> K[i];
        table[S[i] - 1][K[i] - 1] = true;
    }

    ll res = 0;
    for (ll i = 0; i < W; ++i) {
        if (find(S.begin(), S.end(), i + 1) != S.end()) {
            for (ll j = 0; j < H; ++j) {
                if (!table[i][j]) {
                    ++res;
                    table[i][j] = true;
                }
            }
        }
    }
    for (ll j = 0; j < H; ++j) {
        if (find(K.begin(), K.end(), j + 1) != K.end()) {
            for (ll i = 0; i < W; ++i) {
                if (!table[i][j]) {
                    ++res;
                    table[i][j] = true;
                }
            }
        }
    }

    cout << res << endl;
}
0