結果

問題 No.202 1円玉投げ
ユーザー ttkkggww
提出日時 2022-09-20 06:44:51
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 938 ms / 5,000 ms
コード長 890 bytes
コンパイル時間 4,109 ms
コンパイル使用メモリ 251,984 KB
最終ジャッジ日時 2025-02-07 12:56:08
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 38
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:52:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   52 |                 scanf("%lld %lld\n",&x[i],&y[i]);
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

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