結果

問題 No.11 カードマッチ
コンテスト
ユーザー umaumax
提出日時 2017-05-07 17:33:46
言語 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
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 598 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 351 ms
コンパイル使用メモリ 68,336 KB
最終ジャッジ日時 2026-04-04 13:14:56
合計ジャッジ時間 829 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
main.cpp: In function 'int main(int, const char**)':
main.cpp:13:9: error: 'uint64_t' was not declared in this scope
   13 |         uint64_t cnt = 0;
      |         ^~~~~~~~
main.cpp:3:1: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
    2 | #include <map>
  +++ |+#include <cstdint>
    3 | 
main.cpp:19:17: error: expected ';' before 'hms'
   19 |         uint64_t hms                     = hm.size();
      |                 ^~~~
      |                 ;
main.cpp:20:17: error: expected ';' before 'wms'
   20 |         uint64_t wms                     = wm.size();
      |                 ^~~~
      |                 ;
main.cpp:22:28: error: 'cnt' was not declared in this scope; did you mean 'int'?
   22 |                 if (wm[i]) cnt += H - hms;
      |                            ^~~
      |                            int
main.cpp:22:39: error: 'hms' was not declared in this scope; did you mean 'hm'?
   22 |                 if (wm[i]) cnt += H - hms;
      |                                       ^~~
      |                                       hm
main.cpp:24:28: error: 'cnt' was not declared in this scope; did you mean 'int'?
   24 |                 if (hm[i]) cnt += W - wms;
      |                            ^~~
      |                            int
main.cpp:24:39: error: 'wms' was not declared in this scope; did you mean 'wm'?
   24 |                 if (hm[i]) cnt += W - wms;
      |                                       ^~~
      |                                       wm
main.cpp:26:9: error: 'cnt' was not declared in this scope; did you mean 'int'?
   26 |         cnt += hms * wms - N;
      |         ^~~
      |         int
main.cpp:26:16: error: 'hms' was not declared in this scope; did you mean 'hm'?
   26 |         cnt += hms * wms - N;
      |                ^~~
      |                hm
main.cpp:26:22: error: 'wms' was not declared in this scope; did you mean 'wm'?
   26 |         cnt += 

ソースコード

diff #
raw source code

#include <iostream>
#include <map>

using namespace std;

int main(int argc, const char* argv[])
{
	int W, H;
	int N;
	cin >> W >> H >> N;
	map<int, bool> wm;
	map<int, bool> hm;
	uint64_t cnt = 0;
	int S[N];
	int K[N];
	for (int i				 = 0; i < N; i++) cin >> S[i] >> K[i];
	for (auto&& s : S) wm[s] = true;
	for (auto&& k : K) hm[k] = true;
	uint64_t hms			 = hm.size();
	uint64_t wms			 = wm.size();
	for (int i = 1; i <= W; i++)
		if (wm[i]) cnt += H - hms;
	for (int i = 1; i <= H; i++)
		if (hm[i]) cnt += W - wms;
	//	重複削除分
	cnt += hms * wms - N;
	cout << cnt << endl;
	return 0;
}
0