結果

問題 No.202 1円玉投げ
ユーザー Kmcode1Kmcode1
提出日時 2015-05-03 23:36:34
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 151 ms / 5,000 ms
コード長 1,258 bytes
コンパイル時間 676 ms
コンパイル使用メモリ 96,492 KB
実行使用メモリ 9,372 KB
最終ジャッジ日時 2023-08-23 21:32:55
合計ジャッジ時間 3,857 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 50 ms
9,128 KB
testcase_01 AC 103 ms
9,340 KB
testcase_02 AC 2 ms
4,412 KB
testcase_03 AC 2 ms
4,468 KB
testcase_04 AC 2 ms
4,560 KB
testcase_05 AC 5 ms
4,692 KB
testcase_06 AC 119 ms
7,880 KB
testcase_07 AC 138 ms
8,260 KB
testcase_08 AC 137 ms
8,196 KB
testcase_09 AC 62 ms
6,804 KB
testcase_10 AC 20 ms
5,404 KB
testcase_11 AC 49 ms
6,476 KB
testcase_12 AC 52 ms
6,348 KB
testcase_13 AC 22 ms
5,536 KB
testcase_14 AC 6 ms
4,720 KB
testcase_15 AC 60 ms
6,560 KB
testcase_16 AC 36 ms
9,060 KB
testcase_17 AC 44 ms
9,144 KB
testcase_18 AC 43 ms
9,156 KB
testcase_19 AC 56 ms
6,436 KB
testcase_20 AC 106 ms
7,532 KB
testcase_21 AC 55 ms
6,468 KB
testcase_22 AC 3 ms
4,600 KB
testcase_23 AC 3 ms
4,572 KB
testcase_24 AC 2 ms
4,432 KB
testcase_25 AC 2 ms
4,488 KB
testcase_26 AC 3 ms
4,424 KB
testcase_27 AC 3 ms
4,648 KB
testcase_28 AC 2 ms
4,412 KB
testcase_29 AC 2 ms
4,528 KB
testcase_30 AC 2 ms
4,536 KB
testcase_31 AC 2 ms
4,428 KB
testcase_32 AC 2 ms
4,472 KB
testcase_33 AC 3 ms
4,432 KB
testcase_34 AC 3 ms
4,596 KB
testcase_35 AC 41 ms
9,280 KB
testcase_36 AC 39 ms
9,116 KB
testcase_37 AC 151 ms
8,552 KB
testcase_38 AC 41 ms
9,372 KB
testcase_39 AC 2 ms
4,548 KB
testcase_40 AC 2 ms
4,432 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cctype>
#include<cstdlib>
#include<algorithm>
#include<bitset>
#include<vector>
#include<list>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<ctime>
#include<complex>
#include<functional>
#include<climits>
#include<cassert>
#include<iterator>
using namespace std;

int n;
set<int> s[20010];
int dist(int a, int b, int c, int d){
	if (a < c){
		swap(a, c);
	}
	if (b < d){
		swap(b, d);
	}
	return (a - c)*(a - c) + (b - d)*(b - d);
}
int main(){
	scanf("%d", &n);
	set<int>::iterator ite;
	int countt = 0;
	for (int i = 0; i < n; i++){
		int x, y;
		scanf("%d%d", &x, &y);
		int mint = max(0, x - 19);
		int maxt = x + 19;
		bool ok = false;
		for (int j = mint; j <= maxt; j++){
			if (s[j].size() == 0){
				continue;
			}
			ite = s[j].lower_bound(y);
			if (ite != s[j].end()){
				if (dist(x,y,j,(*ite)) < 400){
					ok = true;
					break;
				}
			}
			if (ite != s[j].begin()){
				ite--;
				if (dist(x,y,j,(*ite)) < 400){
					ok = true;
					break;
				}
			}
		}
		if (ok == false){
			s[x].insert(y);
			countt++;
		}
	}
	printf("%d\n", countt);
	return 0;
}
0