結果

問題 No.202 1円玉投げ
ユーザー srup٩(๑`н´๑)۶
提出日時 2016-10-04 23:09:21
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 1,084 bytes
コンパイル時間 721 ms
コンパイル使用メモリ 72,008 KB
実行使用メモリ 17,728 KB
最終ジャッジ日時 2024-12-22 10:52:10
合計ジャッジ時間 136,500 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17 TLE * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <string>
#include <set>
#include <algorithm>
#include <cmath>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)

//TLE
int main(void){
	int n; cin >> n;
	set<pair<int, int> > center;
	//(n^2*logn)でout?
	rep(i, n){
		int cx, cy; cin >> cx >> cy;
		if(center.size() != 0){
			// sort(center.begin(), center.end());//(nlogn)
			int xl = cx - 20, xr = cx + 20;
			int yl = cy - 20, yr = cy + 20;
			//(logn)
			auto it1 = lower_bound(center.begin(), center.end(), make_pair(xl, yl));
    		auto it2 = upper_bound(center.begin(), center.end(), make_pair(xr, yr));
    		bool flag = true;
    		//(n)
    		for(auto itr = it1; itr != it2; ++itr) {
        		auto p = *itr;
        		int nx = p.first, ny = p.second;
        		double len = sqrt((nx - cx) * (nx - cx) + (ny - cy) * (ny - cy));
        		if(len < 20){
        			flag = false;
        			break;
        		}
    		}
    		if(flag)center.insert(make_pair(cx, cy));
		}else{
			center.insert(make_pair(cx, cy));
		}
	}

	printf("%d\n", (int)center.size());
	return 0;
}
0