結果

問題 No.202 1円玉投げ
ユーザー koyumeishikoyumeishi
提出日時 2015-05-03 23:40:33
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,052 bytes
コンパイル時間 740 ms
コンパイル使用メモリ 86,700 KB
実行使用メモリ 9,488 KB
最終ジャッジ日時 2023-08-23 21:37:04
合計ジャッジ時間 4,630 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 222 ms
9,312 KB
testcase_01 AC 100 ms
9,328 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 6 ms
4,588 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 149 ms
9,340 KB
testcase_17 AC 144 ms
9,444 KB
testcase_18 AC 144 ms
9,424 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 3 ms
4,380 KB
testcase_23 AC 3 ms
4,560 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 3 ms
4,376 KB
testcase_27 AC 3 ms
4,380 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 3 ms
4,444 KB
testcase_31 AC 3 ms
4,380 KB
testcase_32 AC 3 ms
4,376 KB
testcase_33 WA -
testcase_34 AC 4 ms
4,376 KB
testcase_35 AC 178 ms
9,328 KB
testcase_36 AC 172 ms
9,376 KB
testcase_37 WA -
testcase_38 AC 183 ms
9,488 KB
testcase_39 AC 3 ms
4,380 KB
testcase_40 AC 2 ms
4,376 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<int> 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<int,int> >>> bucket(20000 / bucket_size + 1, vector<set< pair<int,int> >>(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 -1) && ok; dy++){
			for(int dx=max(0,bx-1); dx<=min(bx+1, 20000 / bucket_size -1) && 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