結果

問題 No.202 1円玉投げ
ユーザー ttkkggww
提出日時 2022-09-20 05:51:58
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 933 bytes
コンパイル時間 4,279 ms
コンパイル使用メモリ 252,136 KB
最終ジャッジ日時 2025-02-07 12:50:50
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#include<atcoder/all>
using namespace atcoder;
using ll = long long;
int n;
vector<ll> x,y;
bool 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++){
		bool canon = true;
		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 = false;
					}
				}
			}
		}
		is[x[i]][y[i]] = canon;
	}
	int ans = 0;
	for(int i = 0;i<20001;i++){
		for(int j = 0;j<20001;j++){
			ans += is[i][j];
		}
	}
	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