結果

問題 No.202 1円玉投げ
ユーザー kaffelunkaffelun
提出日時 2017-10-14 19:37:07
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 74 ms / 5,000 ms
コード長 828 bytes
コンパイル時間 1,135 ms
コンパイル使用メモリ 148,208 KB
実行使用メモリ 20,252 KB
最終ジャッジ日時 2023-08-23 23:34:58
合計ジャッジ時間 4,164 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
19,876 KB
testcase_01 AC 74 ms
19,964 KB
testcase_02 AC 8 ms
19,324 KB
testcase_03 AC 8 ms
19,436 KB
testcase_04 AC 8 ms
19,224 KB
testcase_05 AC 11 ms
19,336 KB
testcase_06 AC 61 ms
19,872 KB
testcase_07 AC 67 ms
19,916 KB
testcase_08 AC 66 ms
19,872 KB
testcase_09 AC 41 ms
19,568 KB
testcase_10 AC 22 ms
19,316 KB
testcase_11 AC 36 ms
19,716 KB
testcase_12 AC 37 ms
19,716 KB
testcase_13 AC 23 ms
19,508 KB
testcase_14 AC 12 ms
19,448 KB
testcase_15 AC 40 ms
19,592 KB
testcase_16 AC 60 ms
20,252 KB
testcase_17 AC 60 ms
20,100 KB
testcase_18 AC 61 ms
20,108 KB
testcase_19 AC 38 ms
19,484 KB
testcase_20 AC 57 ms
19,960 KB
testcase_21 AC 37 ms
19,484 KB
testcase_22 AC 9 ms
19,212 KB
testcase_23 AC 9 ms
19,216 KB
testcase_24 AC 9 ms
19,228 KB
testcase_25 AC 8 ms
19,224 KB
testcase_26 AC 9 ms
19,280 KB
testcase_27 AC 9 ms
19,336 KB
testcase_28 AC 9 ms
19,260 KB
testcase_29 AC 8 ms
19,248 KB
testcase_30 AC 9 ms
19,556 KB
testcase_31 AC 9 ms
19,328 KB
testcase_32 AC 8 ms
19,400 KB
testcase_33 AC 9 ms
19,296 KB
testcase_34 AC 8 ms
19,416 KB
testcase_35 AC 61 ms
19,908 KB
testcase_36 AC 66 ms
19,876 KB
testcase_37 AC 73 ms
20,104 KB
testcase_38 AC 65 ms
19,964 KB
testcase_39 AC 8 ms
19,380 KB
testcase_40 AC 8 ms
19,392 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int pos[2017][2017];
vector<pair<int, int>> coin;
int N;
int main() {
	int ans = 0;
	for(int i = 0; i < 2017; i++) {
		for(int j = 0; j < 2017; j++) {
			pos[i][j] = -1;
		}
	}
	cin >> N;
	int X, Y, x, y, cx, cy;
	int c = -1;
	bool flag = true;
	for(int i = 0; i < N; i++) {
		cin >> X >> Y;
		for(int dy = -2; dy <= 2; dy++) {
			for(int dx = -2; dx <= 2; dx++) {
				x = (X / 10) + dx;
				y = (Y / 10) + dy;
				if(x < 0 || y < 0) continue;
				c = pos[x][y];
				if(c < 0) continue;
				cx = coin[c].first, cy = coin[c].second;
				if((cx - X) * (cx - X) + (cy - Y) * (cy - Y) < 400) {
					flag = false;
				}
			}
		}
		if(flag) {
			ans++;
			pos[X / 10][Y / 10] = coin.size();
			coin.push_back(pair<int, int>(X, Y));
		}
		flag = true;
	}
	cout << ans << endl;
	return 0;
}
0