結果
| 問題 | No.11 カードマッチ |
| コンテスト | |
| ユーザー |
nenuon
|
| 提出日時 | 2017-06-18 15:44:34 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,056 bytes |
| 記録 | |
| コンパイル時間 | 907 ms |
| コンパイル使用メモリ | 90,712 KB |
| 実行使用メモリ | 201,948 KB |
| 最終ジャッジ日時 | 2024-10-01 20:07:12 |
| 合計ジャッジ時間 | 3,512 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 5 WA * 4 RE * 10 |
ソースコード
#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;
int main(){
int h, w, n;
cin >> w >> h >> n;
ll s[n], k[n];
bool p[w+1][h+1];
int nr[w+1], nl[h+1];
int cntr = 0, cntl = 0;
FOR(i,0,w+1) nr[i] = 0;
FOR(i,0,h+1) nl[i] = 0;
FOR(i,0,w+1) FOR(j,0,h+1) p[i][j] = false;
FOR(i,0,n){
cin >> s[i] >> k[i];
p[s[i]][k[i]] = true;
nr[s[i]]++;
nl[k[i]]++;
}
FOR(i,0,w+1) if(nr[i]!=0) cntr++;
FOR(i,0,h+1) if(nl[i]!=0) cntl++;
ll ans = h * cntr - n + w * cntl - n;
ll hiku = 0;
FOR(i,0,n){
FOR(j,0,n){
if(i==j) continue;
if(!p[s[i]][k[j]]) hiku++;
}
}
cout << ans - hiku << endl;
return 0;
}
nenuon