結果

問題 No.11 カードマッチ
ユーザー woodsgreenwoodsgreen
提出日時 2022-01-11 01:17:12
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 8 ms / 5,000 ms
コード長 413 bytes
コンパイル時間 2,243 ms
コンパイル使用メモリ 198,168 KB
実行使用メモリ 11,392 KB
最終ジャッジ日時 2023-08-09 05:34:19
合計ジャッジ時間 3,847 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 7 ms
11,148 KB
testcase_01 AC 7 ms
11,072 KB
testcase_02 AC 7 ms
11,068 KB
testcase_03 AC 7 ms
11,140 KB
testcase_04 AC 7 ms
11,220 KB
testcase_05 AC 7 ms
11,076 KB
testcase_06 AC 7 ms
11,392 KB
testcase_07 AC 7 ms
11,212 KB
testcase_08 AC 7 ms
11,148 KB
testcase_09 AC 8 ms
11,124 KB
testcase_10 AC 7 ms
11,272 KB
testcase_11 AC 8 ms
11,072 KB
testcase_12 AC 8 ms
11,212 KB
testcase_13 AC 7 ms
11,072 KB
testcase_14 AC 8 ms
11,388 KB
testcase_15 AC 6 ms
11,160 KB
testcase_16 AC 7 ms
11,084 KB
testcase_17 AC 7 ms
11,156 KB
testcase_18 AC 7 ms
11,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
const int N=1000000;
long long w,h,ans;
int n,a,b,ww[N+10],hh[N+10],wc,hc;
int main(){
	cin>>w>>h;
	cin>>n;
	memset(ww,0,sizeof(ww));
	memset(hh,0,sizeof(hh));
	for(int i=0;i<n;++i){
		cin>>a>>b;
		ww[a]=hh[b]=1;
	}
	wc=hc=0;
	for(int i=0;i<N;++i){
	    if(ww[i]) ++wc;
	    if(hh[i]) ++hc;
    }
	cout<<w*hc+h*wc-hc*wc-n<<endl;
    return 0;
}
0