結果

問題 No.11 カードマッチ
ユーザー nenuonnenuon
提出日時 2017-06-18 16:07:19
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,016 bytes
コンパイル時間 1,062 ms
コンパイル使用メモリ 103,456 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-09 19:54:19
合計ジャッジ時間 1,843 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
using namespace std;

#define PI         acos(-1.0)
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)

typedef long long ll;
typedef pair<ll, ll> P;

ll s[100], k[100];
map<P, bool> MAP;
map<ll, int> MAPr;
map<ll, int> MAPl;

int main(){
    ll h, w, n;
    cin >> w >> h >> n;
    int cntr = 0, cntl = 0;
    FOR(i,0,n){
        cin >> s[i] >> k[i];
        MAP[P(s[i], k[i])] = true;
        MAP[P(k[i], s[i])] = true;
        MAPr[s[i]]++;
        MAPl[k[i]]++;
    }
    cntr = MAPr.size();
    cntl = MAPl.size();

    ll ans = h * cntr - n + w * cntl - n;
    ll hiku = 0;
    FOR(i,0,n){
        FOR(j,0,n){
            if(i==j) continue;
            if(MAP.count(P(s[i], k[j])) == 0) hiku++;
        }
    }

    cout << ans - hiku << endl;
    return 0;
}
0