結果

問題 No.202 1円玉投げ
ユーザー srup٩(๑`н´๑)۶srup٩(๑`н´๑)۶
提出日時 2016-10-04 18:09:16
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 1,207 bytes
コンパイル時間 556 ms
コンパイル使用メモリ 73,288 KB
実行使用メモリ 12,072 KB
最終ジャッジ日時 2023-08-23 23:27:48
合計ジャッジ時間 13,197 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
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 <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
static const int mod = 1e9 + 7;

int main(void){
	int n; cin >> n;
	vector<pair<int, int> > center;
	rep(i, n){
		// printf("i %d\n", i);
		int cx, cy; cin >> cx >> cy;
		if(center.size() != 0){
			//x座標が近いものを探す
			sort(center.begin(), center.end());
			int xl = cx - 21, xr = cx + 21;
			int yl = cy - 21, yr = cy + 21;
			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;
    		for(auto itr = it1; itr != it2; ++itr) {
        		auto p = *itr;
        		int nx = p.first, ny = p.second;
        		// printf("%d %d\n", nx, ny);
        		double len = sqrt((nx - cx) * (nx - cx) + (ny - cy) * (ny - cy));
        		// printf("len %f\n",len );
        		if(len < 20){
        			flag = false;
        			break;
        		}
    		}
    		if(flag)center.push_back(make_pair(cx, cy));
		}else{
			center.push_back(make_pair(cx, cy));
		}
	}

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