結果
| 問題 | No.11 カードマッチ | 
| コンテスト | |
| ユーザー |  nenuon | 
| 提出日時 | 2017-06-18 16:07:19 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 1,016 bytes | 
| コンパイル時間 | 1,626 ms | 
| コンパイル使用メモリ | 104,460 KB | 
| 実行使用メモリ | 6,824 KB | 
| 最終ジャッジ日時 | 2024-10-01 20:08:10 | 
| 合計ジャッジ時間 | 1,862 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 13 WA * 6 | 
ソースコード
#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;
}
            
            
            
        