結果

問題 No.202 1円玉投げ
ユーザー ttkkggwwttkkggww
提出日時 2022-09-20 05:59:23
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,063 ms / 5,000 ms
コード長 951 bytes
コンパイル時間 4,802 ms
コンパイル使用メモリ 261,840 KB
実行使用メモリ 321,292 KB
最終ジャッジ日時 2023-08-24 00:26:41
合計ジャッジ時間 23,638 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 430 ms
9,336 KB
testcase_01 AC 1,063 ms
321,292 KB
testcase_02 AC 208 ms
4,376 KB
testcase_03 AC 207 ms
4,380 KB
testcase_04 AC 207 ms
4,380 KB
testcase_05 AC 237 ms
26,588 KB
testcase_06 AC 826 ms
211,196 KB
testcase_07 AC 921 ms
225,604 KB
testcase_08 AC 942 ms
226,516 KB
testcase_09 AC 606 ms
156,204 KB
testcase_10 AC 358 ms
79,464 KB
testcase_11 AC 518 ms
135,428 KB
testcase_12 AC 536 ms
138,388 KB
testcase_13 AC 378 ms
86,592 KB
testcase_14 AC 246 ms
30,300 KB
testcase_15 AC 584 ms
152,132 KB
testcase_16 AC 399 ms
9,756 KB
testcase_17 AC 446 ms
11,464 KB
testcase_18 AC 445 ms
11,448 KB
testcase_19 AC 549 ms
145,584 KB
testcase_20 AC 764 ms
198,580 KB
testcase_21 AC 551 ms
144,688 KB
testcase_22 AC 197 ms
7,504 KB
testcase_23 AC 199 ms
7,500 KB
testcase_24 AC 207 ms
4,380 KB
testcase_25 AC 208 ms
4,376 KB
testcase_26 AC 209 ms
4,380 KB
testcase_27 AC 208 ms
4,376 KB
testcase_28 AC 208 ms
4,376 KB
testcase_29 AC 209 ms
4,376 KB
testcase_30 AC 200 ms
7,440 KB
testcase_31 AC 209 ms
4,376 KB
testcase_32 AC 200 ms
7,624 KB
testcase_33 AC 210 ms
4,956 KB
testcase_34 AC 209 ms
4,380 KB
testcase_35 AC 435 ms
7,228 KB
testcase_36 AC 445 ms
10,704 KB
testcase_37 AC 952 ms
234,436 KB
testcase_38 AC 437 ms
7,092 KB
testcase_39 AC 204 ms
4,504 KB
testcase_40 AC 204 ms
4,376 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 = -30;i<30;i++){
		for(int j = -30;j<30;j++){
			if(dist20(i,j)){
				dx.push_back(i);
				dy.push_back(j);
			}
		}
	}
	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)
		is[x[i]][y[i]] = canon;
	}
	int ans = 0;
	for(int i = 0;i<20001;i++){
		for(int j = 0;j<20001;j++){
			if(is[i][j]){
				ans++;
			}
		}
	}
	cout<<ans<<endl;
}

signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cin >> n;
	x = y = vector<ll>(n);
	for(int i =0;i<n;i++){
		cin >> x[i] >> y[i];
	}
	solve();
}
0