結果

問題 No.202 1円玉投げ
ユーザー fiordfiord
提出日時 2016-02-04 01:07:14
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 834 bytes
コンパイル時間 1,281 ms
コンパイル使用メモリ 151,976 KB
実行使用メモリ 12,680 KB
最終ジャッジ日時 2023-08-23 23:14:50
合計ジャッジ時間 15,526 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,369 ms
8,632 KB
testcase_01 AC 507 ms
8,632 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 9 ms
4,380 KB
testcase_06 AC 490 ms
6,948 KB
testcase_07 AC 594 ms
7,472 KB
testcase_08 AC 609 ms
7,488 KB
testcase_09 AC 237 ms
5,628 KB
testcase_10 AC 58 ms
4,448 KB
testcase_11 AC 170 ms
5,236 KB
testcase_12 AC 181 ms
5,360 KB
testcase_13 AC 68 ms
4,568 KB
testcase_14 AC 12 ms
4,380 KB
testcase_15 AC 225 ms
5,616 KB
testcase_16 AC 986 ms
8,516 KB
testcase_17 TLE -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
権限があれば一括ダウンロードができます

ソースコード

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));
		if(it==grd.end()){
			grd.insert(make_pair(x[i],y[i]));
			cnt++;
		}
		else{
			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=grd.lower_bound(make_pair(it->first,it->second+1));
			}
			if(canput){
				grd.insert(make_pair(x[i],y[i]));
				cnt++;
			}
		}
	}
	cout<<cnt<<endl;
	return 0;
}
0