結果

問題 No.202 1円玉投げ
ユーザー ttkkggwwttkkggww
提出日時 2022-09-20 06:44:51
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 864 ms / 5,000 ms
コード長 890 bytes
コンパイル時間 5,371 ms
コンパイル使用メモリ 262,516 KB
実行使用メモリ 321,416 KB
最終ジャッジ日時 2023-08-24 00:25:04
合計ジャッジ時間 15,176 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 268 ms
9,184 KB
testcase_01 AC 864 ms
321,416 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 47 ms
26,656 KB
testcase_06 AC 629 ms
211,040 KB
testcase_07 AC 704 ms
225,500 KB
testcase_08 AC 707 ms
226,684 KB
testcase_09 AC 378 ms
156,088 KB
testcase_10 AC 161 ms
79,664 KB
testcase_11 AC 313 ms
135,532 KB
testcase_12 AC 324 ms
138,192 KB
testcase_13 AC 178 ms
86,812 KB
testcase_14 AC 54 ms
30,356 KB
testcase_15 AC 373 ms
152,284 KB
testcase_16 AC 261 ms
9,936 KB
testcase_17 AC 276 ms
11,428 KB
testcase_18 AC 277 ms
11,444 KB
testcase_19 AC 356 ms
145,632 KB
testcase_20 AC 563 ms
198,652 KB
testcase_21 AC 351 ms
144,512 KB
testcase_22 AC 11 ms
7,608 KB
testcase_23 AC 11 ms
7,544 KB
testcase_24 AC 5 ms
4,380 KB
testcase_25 AC 5 ms
4,376 KB
testcase_26 AC 4 ms
4,376 KB
testcase_27 AC 4 ms
4,376 KB
testcase_28 AC 4 ms
4,376 KB
testcase_29 AC 4 ms
4,376 KB
testcase_30 AC 11 ms
7,612 KB
testcase_31 AC 4 ms
4,380 KB
testcase_32 AC 12 ms
7,588 KB
testcase_33 AC 6 ms
5,000 KB
testcase_34 AC 5 ms
4,380 KB
testcase_35 AC 267 ms
7,124 KB
testcase_36 AC 286 ms
10,516 KB
testcase_37 AC 776 ms
234,548 KB
testcase_38 AC 270 ms
7,128 KB
testcase_39 AC 4 ms
4,548 KB
testcase_40 AC 3 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#include<atcoder/all>
using namespace atcoder;
using ll = long long;
int n;
vector<ll> x,y;
char is[20001][20001];
vector<int> dx,dy;

bool dist20(int sx,int sy){
	return sx*sx+sy*sy<400;
}

void solve(){
	for(int i = -100;i<100;i++){
		for(int j = -100;j<100;j++){
			if(dist20(i,j)){
				dx.push_back(i);
				dy.push_back(j);
			}
		}
	}
	int ans = 0;
	for(int i = 0;i<n;i++){
		char canon = 1;
		for(int j = 0;j<dx.size();j++){
			int nx = x[i]+dx[j];
			int ny = y[i]+dy[j];
			if(0<=nx&&nx<20001){
				if(0<=ny&&ny<20001){
					if(is[nx][ny]){
						canon = 0;
					}
				}
			}
		}
		if(canon){
			//cout<<x[i]<<' '<<y[i]<<endl;
			ans++;
			is[x[i]][y[i]] = canon;
		}
	}
	cout<<ans<<endl;
}

signed main(){
	cin >> n;
	n = min(100000,n);
	x = y = vector<ll>(n);
	for(int i =0;i<n;i++){
		scanf("%lld %lld\n",&x[i],&y[i]);
	}
	solve();
}
0