結果

問題 No.202 1円玉投げ
ユーザー koyumeishikoyumeishi
提出日時 2015-05-03 23:42:43
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,082 bytes
コンパイル時間 1,082 ms
コンパイル使用メモリ 86,608 KB
実行使用メモリ 11,808 KB
最終ジャッジ日時 2023-08-23 21:37:23
合計ジャッジ時間 5,054 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 264 ms
11,784 KB
testcase_01 AC 106 ms
11,808 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 3 ms
4,376 KB
testcase_05 AC 7 ms
4,632 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 152 ms
11,804 KB
testcase_17 AC 147 ms
11,660 KB
testcase_18 AC 147 ms
11,788 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 3 ms
4,380 KB
testcase_23 AC 3 ms
4,376 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,380 KB
testcase_31 AC 3 ms
4,376 KB
testcase_32 AC 3 ms
4,380 KB
testcase_33 WA -
testcase_34 AC 4 ms
4,376 KB
testcase_35 AC 182 ms
11,784 KB
testcase_36 AC 185 ms
11,784 KB
testcase_37 WA -
testcase_38 AC 186 ms
11,780 KB
testcase_39 AC 3 ms
4,376 KB
testcase_40 AC 2 ms
4,384 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 -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