結果

問題 No.11 カードマッチ
コンテスト
ユーザー Onju
提出日時 2015-02-09 18:57:40
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
TLE  
実行時間 -
コード長 623 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 643 ms
コンパイル使用メモリ 92,976 KB
実行使用メモリ 16,200 KB
最終ジャッジ日時 2026-03-08 17:21:52
合計ジャッジ時間 65,604 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 9 TLE * 10
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <algorithm>
#include <cstring>
#include <climits>
#include <unordered_set>
#define W_MAX 1000000
#define H_MAX 1000000
#define N_MAX 100
using namespace std;
typedef long long LL;

int main()
{
	LL W, H, ans;
	int N, S, K;
	unordered_set<int> Sset, Kset;
	cin >> W >> H >> N;

	for (int i = 0; i < N; ++i)
	{
		cin >> S >> K;
		Sset.insert(S);
		Kset.insert(K);
	}

	ans = -N;
	for (int w = 1; w <= W; ++w)
	{
		for (int h = 1; h <= H; ++h)
		{
			auto sit = Sset.find(w);
			auto kit = Kset.find(h);
			if (sit != Sset.end() || kit != Kset.end())
				++ans;
		}
	}

	cout << ans;

	return 0;
}
0