結果

問題 No.202 1円玉投げ
ユーザー fiordfiord
提出日時 2016-02-04 17:44:18
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 1,588 ms / 5,000 ms
コード長 686 bytes
コンパイル時間 1,297 ms
コンパイル使用メモリ 151,660 KB
実行使用メモリ 8,684 KB
最終ジャッジ日時 2023-08-23 23:15:04
合計ジャッジ時間 12,375 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 293 ms
8,588 KB
testcase_01 AC 347 ms
8,268 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 8 ms
4,380 KB
testcase_06 AC 340 ms
6,956 KB
testcase_07 AC 405 ms
7,492 KB
testcase_08 AC 421 ms
7,668 KB
testcase_09 AC 163 ms
5,620 KB
testcase_10 AC 42 ms
4,512 KB
testcase_11 AC 118 ms
5,240 KB
testcase_12 AC 124 ms
5,352 KB
testcase_13 AC 50 ms
4,576 KB
testcase_14 AC 10 ms
4,380 KB
testcase_15 AC 155 ms
5,620 KB
testcase_16 AC 117 ms
8,532 KB
testcase_17 AC 1,114 ms
8,520 KB
testcase_18 AC 1,133 ms
8,532 KB
testcase_19 AC 141 ms
5,388 KB
testcase_20 AC 298 ms
6,704 KB
testcase_21 AC 139 ms
5,404 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 3 ms
4,376 KB
testcase_26 AC 5 ms
4,376 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 2 ms
4,376 KB
testcase_29 AC 2 ms
4,376 KB
testcase_30 AC 2 ms
4,376 KB
testcase_31 AC 2 ms
4,376 KB
testcase_32 AC 3 ms
4,380 KB
testcase_33 AC 2 ms
4,376 KB
testcase_34 AC 3 ms
4,376 KB
testcase_35 AC 1,583 ms
8,564 KB
testcase_36 AC 103 ms
8,564 KB
testcase_37 AC 450 ms
7,784 KB
testcase_38 AC 1,588 ms
8,684 KB
testcase_39 AC 2 ms
4,376 KB
testcase_40 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int dist(int x1,int y1,int x2,int y2){
	return (x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
}
int main(){
	int n;	cin>>n;
	vector<int> x(n),y(n);
	for(int i=0;i<n;i++)	cin>>x[i]>>y[i];
	set<pair<int,int>> grd;
	int cnt=0;
	for(int i=0;i<n;i++){
		auto it=grd.lower_bound(make_pair(x[i]-20,y[i]-20));
		bool canput=true;
		while(it!=grd.end()&&it->first<=x[i]+20){
			if(dist(x[i],y[i],it->first,it->second)<400){
				canput=false;
				break;
			}
			if(y[i]+20<it->second){
				it=grd.lower_bound(make_pair(it->first+1,y[i]-20));
			}
			else it++;
		}
		if(canput){
			grd.insert(make_pair(x[i],y[i]));
			cnt++;
		}
	}
	cout<<cnt<<endl;
	return 0;
}
0