結果

問題 No.11 カードマッチ
ユーザー tokkakatokkaka
提出日時 2016-07-17 18:58:34
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 1,026 bytes
コンパイル時間 920 ms
コンパイル使用メモリ 102,712 KB
実行使用メモリ 814,848 KB
最終ジャッジ日時 2024-04-23 15:05:56
合計ジャッジ時間 6,562 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 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 <sstream>
#include <string>
#include <vector>
#include <functional>
#include <tuple>
#include <climits>
#include <algorithm>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <iomanip>

using namespace std;

int main()
{
    int W, H, N;
    cin >> W >> H >> N;
    vector<int> S(N), K(N);
    set<tuple<int, int>> hand;
    set<tuple<int, int>> match;
    enum {
        suit = 0,
        number = 1
    };
    for(int i=0; i<N; i++) {
        cin >> S[i] >> K[i];
        hand.insert(make_tuple(S[i], K[i]));
    }
    for(const auto &h : hand) {
        for(int i=1; i<=W; i++) {
            if(hand.count(make_tuple(i, get<number>(h))) == 0) {
                match.insert(make_tuple(i, get<number>(h)));
            } 
        }
        for(int i=1; i<=H; i++) {
            if(hand.count(make_tuple(get<suit>(h), i)) == 0) {
                match.insert(make_tuple(get<suit>(h), i));
            }
        }
    }
    cout << match.size() << endl;
}
0