結果

問題 No.202 1円玉投げ
ユーザー koyumeishikoyumeishi
提出日時 2015-05-03 23:43:26
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 269 ms / 5,000 ms
コード長 1,078 bytes
コンパイル時間 802 ms
コンパイル使用メモリ 86,552 KB
実行使用メモリ 11,940 KB
最終ジャッジ日時 2023-08-23 21:38:22
合計ジャッジ時間 4,996 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 269 ms
11,940 KB
testcase_01 AC 108 ms
11,748 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 3 ms
4,380 KB
testcase_05 AC 7 ms
4,708 KB
testcase_06 AC 89 ms
9,736 KB
testcase_07 AC 105 ms
10,492 KB
testcase_08 AC 107 ms
10,356 KB
testcase_09 AC 51 ms
7,760 KB
testcase_10 AC 20 ms
5,492 KB
testcase_11 AC 41 ms
6,920 KB
testcase_12 AC 42 ms
7,292 KB
testcase_13 AC 22 ms
5,640 KB
testcase_14 AC 7 ms
4,748 KB
testcase_15 AC 49 ms
7,504 KB
testcase_16 AC 155 ms
11,928 KB
testcase_17 AC 148 ms
11,672 KB
testcase_18 AC 148 ms
11,788 KB
testcase_19 AC 46 ms
7,292 KB
testcase_20 AC 79 ms
9,288 KB
testcase_21 AC 45 ms
7,336 KB
testcase_22 AC 3 ms
4,376 KB
testcase_23 AC 3 ms
4,376 KB
testcase_24 AC 3 ms
4,376 KB
testcase_25 AC 3 ms
4,376 KB
testcase_26 AC 3 ms
4,380 KB
testcase_27 AC 3 ms
4,380 KB
testcase_28 AC 3 ms
4,380 KB
testcase_29 AC 3 ms
4,376 KB
testcase_30 AC 3 ms
4,380 KB
testcase_31 AC 3 ms
4,376 KB
testcase_32 AC 3 ms
4,380 KB
testcase_33 AC 4 ms
4,380 KB
testcase_34 AC 4 ms
4,376 KB
testcase_35 AC 183 ms
11,752 KB
testcase_36 AC 189 ms
11,724 KB
testcase_37 AC 121 ms
10,956 KB
testcase_38 AC 188 ms
11,660 KB
testcase_39 AC 2 ms
4,380 KB
testcase_40 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cstdio>
#include <sstream>
#include <map>
#include <string>
#include <algorithm>
#include <queue>
#include <cmath>
#include <set>
using namespace std;

int main(){
	int N;
	cin >> N;
	vector<long long> x(N), y(N);
	for(int i=0; i<N; i++){
		cin >> x[i] >> y[i];
	}
	int ans = 0;
	int bucket_size = 150;
	vector<vector<set< pair<long long,long long> >>> bucket(20000 / bucket_size + 1, vector<set< pair<long long,long long> >>(20000 / bucket_size + 1));
	for(int i=0; i<N; i++){
		int bx = x[i] / bucket_size;
		int by = y[i] / bucket_size;

		bool ok = true;
		for(int dy=max(0,by-1); dy<=min(by+1, 20000 / bucket_size ) && ok; dy++){
			for(int dx=max(0,bx-1); dx<=min(bx+1, 20000 / bucket_size ) && ok; dx++){
				for(auto itr = bucket[dy][dx].begin(); itr != bucket[dy][dx].end() && ok; itr++){
					if( (itr->first - x[i])*(itr->first - x[i]) + (itr->second - y[i])*(itr->second - y[i]) < 20*20 ) ok = false;
				}
			}
		}
		if(ok){
			ans++;
			bucket[by][bx].insert({x[i], y[i]});
		}
	}

	cout << ans << endl;
	return 0;
}
0