結果

問題 No.11 カードマッチ
ユーザー KKT89
提出日時 2020-06-09 02:47:31
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 5,000 ms
コード長 430 bytes
コンパイル時間 922 ms
コンパイル使用メモリ 80,772 KB
最終ジャッジ日時 2025-01-11 00:18:49
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
typedef long long int ll;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	ll h,w; cin >> h >> w;
	int q; cin >> q;
	ll res=-q;
	set<int> hh,ww;
	while(q--){
		int x,y; cin >> x >> y;
		x--; y--;
		hh.insert(x);
		ww.insert(y);
	}
	res+=(ll)hh.size()*w+(ll)ww.size()*h-(ll)hh.size()*(ll)ww.size();
	cout << res << endl;
}
0