結果

問題 No.202 1円玉投げ
ユーザー airisairis
提出日時 2015-05-04 00:33:43
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 75 ms / 5,000 ms
コード長 1,486 bytes
コンパイル時間 613 ms
コンパイル使用メモリ 80,440 KB
実行使用メモリ 6,900 KB
最終ジャッジ日時 2023-08-23 21:58:20
合計ジャッジ時間 3,593 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
6,292 KB
testcase_01 AC 75 ms
6,900 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 3 ms
4,376 KB
testcase_04 AC 2 ms
4,552 KB
testcase_05 AC 7 ms
4,580 KB
testcase_06 AC 62 ms
6,308 KB
testcase_07 AC 69 ms
6,580 KB
testcase_08 AC 70 ms
6,592 KB
testcase_09 AC 40 ms
5,732 KB
testcase_10 AC 17 ms
5,060 KB
testcase_11 AC 34 ms
5,552 KB
testcase_12 AC 35 ms
5,568 KB
testcase_13 AC 19 ms
5,124 KB
testcase_14 AC 7 ms
4,612 KB
testcase_15 AC 37 ms
5,992 KB
testcase_16 AC 65 ms
6,536 KB
testcase_17 AC 66 ms
6,464 KB
testcase_18 AC 66 ms
6,444 KB
testcase_19 AC 36 ms
5,924 KB
testcase_20 AC 58 ms
6,344 KB
testcase_21 AC 36 ms
5,792 KB
testcase_22 AC 3 ms
4,420 KB
testcase_23 AC 3 ms
4,388 KB
testcase_24 AC 3 ms
4,424 KB
testcase_25 AC 3 ms
4,376 KB
testcase_26 AC 3 ms
4,504 KB
testcase_27 AC 3 ms
4,380 KB
testcase_28 AC 2 ms
4,380 KB
testcase_29 AC 3 ms
4,504 KB
testcase_30 AC 2 ms
4,464 KB
testcase_31 AC 3 ms
4,648 KB
testcase_32 AC 3 ms
4,408 KB
testcase_33 AC 3 ms
4,432 KB
testcase_34 AC 3 ms
4,508 KB
testcase_35 AC 66 ms
6,212 KB
testcase_36 AC 72 ms
6,300 KB
testcase_37 AC 75 ms
6,848 KB
testcase_38 AC 72 ms
6,256 KB
testcase_39 AC 3 ms
4,556 KB
testcase_40 AC 3 ms
4,424 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <numeric>
#define rep(x, to) for (int x = 0; x < (to); x++)
#define REP(x, a, to) for (int x = (a); x < (to); x++)
#define foreach(itr, x) for (typeof((x).begin()) itr = (x).begin(); itr != (x).end(); itr++)
#define sq(x) ((x) * (x))

using namespace std;

typedef long long ll;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;

const int BOX_N = 205;

int N;
int X[100005];
int Y[100005];

vector< vector< vector<PII> > > box(BOX_N);

int ans;

int mx[] = {1, 1, 0, -1, -1, -1, 0, 1};
int my[] = {0, 1, 1,  1,  0, -1,-1,-1};

int dist(PII a, PII b) {
	return sq(a.first - b.first) + sq(a.second - b.second);
}

void solve(int x, int y) {
	int bx = x / 100;
	int by = y / 100;
	bool add = true;
	//着目
	{
		rep(i, box[by][bx].size()) {
			if (dist(box[by][bx][i], PII(y, x)) < 400) {
				add = false;
			}
		}
	}
	//着目近傍
	rep(k, 8) {
		int nx = bx + mx[k];
		int ny = by + my[k];
		if (nx < 0 || ny < 0) continue;
		rep(i, box[ny][nx].size()) {
			if (dist(box[ny][nx][i], PII(y, x)) < 400) {
				add = false;
			}
		}
	}
	if (add) {
		box[by][bx].push_back(PII(y, x));
		ans++;
	}
}

int main() {
	rep(i, BOX_N) box[i].resize(BOX_N);
	cin >> N;
	rep(i, N) {
		cin >> X[i] >> Y[i];
		solve(X[i], Y[i]);
	}
	cout << ans << endl;
	return 0;
}


0