結果

問題 No.202 1円玉投げ
ユーザー srup٩(๑`н´๑)۶srup٩(๑`н´๑)۶
提出日時 2017-03-14 21:49:48
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 669 ms / 5,000 ms
コード長 1,672 bytes
コンパイル時間 1,406 ms
コンパイル使用メモリ 151,032 KB
実行使用メモリ 47,484 KB
最終ジャッジ日時 2023-08-23 23:31:21
合計ジャッジ時間 11,338 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 571 ms
47,484 KB
testcase_01 AC 669 ms
47,072 KB
testcase_02 AC 2 ms
4,564 KB
testcase_03 AC 3 ms
4,528 KB
testcase_04 AC 3 ms
4,656 KB
testcase_05 AC 14 ms
7,068 KB
testcase_06 AC 518 ms
35,948 KB
testcase_07 AC 607 ms
39,372 KB
testcase_08 AC 603 ms
39,524 KB
testcase_09 AC 256 ms
25,212 KB
testcase_10 AC 72 ms
13,576 KB
testcase_11 AC 192 ms
21,708 KB
testcase_12 AC 195 ms
22,128 KB
testcase_13 AC 85 ms
14,484 KB
testcase_14 AC 17 ms
7,500 KB
testcase_15 AC 260 ms
24,532 KB
testcase_16 AC 295 ms
46,636 KB
testcase_17 AC 319 ms
46,752 KB
testcase_18 AC 304 ms
46,664 KB
testcase_19 AC 215 ms
23,336 KB
testcase_20 AC 451 ms
33,088 KB
testcase_21 AC 199 ms
23,204 KB
testcase_22 AC 4 ms
4,828 KB
testcase_23 AC 4 ms
4,972 KB
testcase_24 AC 3 ms
4,684 KB
testcase_25 AC 3 ms
4,588 KB
testcase_26 AC 3 ms
4,860 KB
testcase_27 AC 4 ms
4,948 KB
testcase_28 AC 3 ms
4,648 KB
testcase_29 AC 3 ms
4,552 KB
testcase_30 AC 4 ms
4,968 KB
testcase_31 AC 3 ms
4,544 KB
testcase_32 AC 4 ms
4,988 KB
testcase_33 AC 4 ms
4,804 KB
testcase_34 AC 7 ms
4,940 KB
testcase_35 AC 381 ms
46,384 KB
testcase_36 AC 390 ms
47,460 KB
testcase_37 AC 668 ms
41,620 KB
testcase_38 AC 399 ms
47,372 KB
testcase_39 AC 3 ms
4,608 KB
testcase_40 AC 2 ms
4,672 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;

int n;
int x[100010], y[100010];
set<pair<int, int>> se[150][150];

int dist(int x, int y){
	return x * x + y * y;
}
int main(void){
	cin >> n;
	rep(i, n) cin >> x[i] >> y[i];
	int ans = 0;
	rep(i, n){
		// printf("x %d y %d\n", x[i], y[i]);
		int cx = x[i] / 150, cy = y[i] / 150;
		bool flag = true;
		for(auto u : se[cx][cy]){
			int nx = u.fi, ny = u.se;
			auto d = dist(nx - x[i], ny - y[i]);
			// printf("%d %d %d \n", nx, ny, d);
			if(d < 400){
				flag = false;
				break;
			}
		}
		if(flag){
			ans++;
			se[cx][cy].insert(mp(x[i], y[i]));
			se[max(cx - 1, 0)][cy].insert(mp(x[i], y[i]));
			se[cx + 1][cy].insert(mp(x[i], y[i]));
			se[cx][max(cy - 1, 0)].insert(mp(x[i], y[i]));
			se[cx][cy + 1].insert(mp(x[i], y[i]));

			se[max(cx - 1, 0)][max(cy - 1, 0)].insert(mp(x[i], y[i]));
			se[cx + 1][max(cy - 1, 0)].insert(mp(x[i], y[i]));
			se[max(cx - 1, 0)][cy + 1].insert(mp(x[i], y[i]));
			se[cx + 1][cy + 1].insert(mp(x[i], y[i]));
		}
	}
	printf("%d\n", ans);
	return 0;
}
0