結果

問題 No.202 1円玉投げ
ユーザー hotpepsihotpepsi
提出日時 2015-05-05 01:33:58
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 129 ms / 5,000 ms
コード長 1,026 bytes
コンパイル時間 689 ms
コンパイル使用メモリ 74,632 KB
実行使用メモリ 10,076 KB
最終ジャッジ日時 2023-08-23 22:24:59
合計ジャッジ時間 4,560 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
10,076 KB
testcase_01 AC 121 ms
9,940 KB
testcase_02 AC 4 ms
5,260 KB
testcase_03 AC 3 ms
5,272 KB
testcase_04 AC 3 ms
5,372 KB
testcase_05 AC 10 ms
5,556 KB
testcase_06 AC 102 ms
8,812 KB
testcase_07 AC 118 ms
9,116 KB
testcase_08 AC 117 ms
9,092 KB
testcase_09 AC 64 ms
7,516 KB
testcase_10 AC 27 ms
6,264 KB
testcase_11 AC 51 ms
7,212 KB
testcase_12 AC 55 ms
7,244 KB
testcase_13 AC 29 ms
6,468 KB
testcase_14 AC 10 ms
5,716 KB
testcase_15 AC 63 ms
7,572 KB
testcase_16 AC 109 ms
10,012 KB
testcase_17 AC 106 ms
10,072 KB
testcase_18 AC 106 ms
9,996 KB
testcase_19 AC 56 ms
7,344 KB
testcase_20 AC 91 ms
8,656 KB
testcase_21 AC 58 ms
7,432 KB
testcase_22 AC 4 ms
5,356 KB
testcase_23 AC 4 ms
5,368 KB
testcase_24 AC 4 ms
5,264 KB
testcase_25 AC 4 ms
5,452 KB
testcase_26 AC 5 ms
5,356 KB
testcase_27 AC 4 ms
5,420 KB
testcase_28 AC 4 ms
5,280 KB
testcase_29 AC 4 ms
5,316 KB
testcase_30 AC 5 ms
5,364 KB
testcase_31 AC 4 ms
5,284 KB
testcase_32 AC 4 ms
5,308 KB
testcase_33 AC 4 ms
5,288 KB
testcase_34 AC 4 ms
5,496 KB
testcase_35 AC 108 ms
10,064 KB
testcase_36 AC 112 ms
10,076 KB
testcase_37 AC 129 ms
9,448 KB
testcase_38 AC 111 ms
9,952 KB
testcase_39 AC 3 ms
5,320 KB
testcase_40 AC 4 ms
5,456 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <sstream>
#include <set>
#include <vector>
#include <cstdio>

using namespace std;

typedef pair<int, int> II;
typedef set<II> IISet;

int main(int argc, char *argv[])
{
	string s;
	getline(cin, s);
	int N = atoi(s.c_str());
	int ans = 0;
	IISet coins[202][202];
	for (int i = 0; i < N; ++i) {
		getline(cin, s);
		stringstream ss(s);
		int x, y;
		ss >> x >> y;
		int sx = (x - 20 + 50) / 100;
		int ex = (x + 20 + 50) / 100;
		int sy = (y - 20 + 50) / 100;
		int ey = (y + 20 + 50) / 100;
		bool remove = false;
		for (int i = sy; i <= ey; ++i) {
			for (int j = sx; j <= ex; ++j) {
				IISet &a = coins[i][j];
				IISet::const_iterator it;
				for (it = a.begin(); it != a.end(); ++it) {
					int dx = it->first - x;
					int dy = it->second - y;
					if ((dx * dx + dy * dy) < 20 * 20) {
						remove = true;
						break;
					}
				}
			}
		}
		if (!remove) {
			coins[(y + 50) / 100][(x + 50) / 100].insert(II(x, y));
			++ans;
		}
	}
	cout << ans << endl;
	return 0;
}
0