結果

問題 No.202 1円玉投げ
ユーザー fura
提出日時 2020-06-08 09:17:40
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 1,055 ms / 5,000 ms
コード長 484 bytes
コンパイル時間 2,416 ms
コンパイル使用メモリ 191,416 KB
最終ジャッジ日時 2025-01-11 00:10:12
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 38
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:21: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |         int n; scanf("%d",&n);
      |                ~~~~~^~~~~~~~~
main.cpp:13:31: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   13 |                 int x,y; scanf("%d%d",&x,&y);
      |                          ~~~~~^~~~~~~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main(){
	int n; scanf("%d",&n);

	int ans=0;
	static bool f[20001][20001];
	rep(i,n){
		int x,y; scanf("%d%d",&x,&y);
		bool ok=true;
		for(int y2=max(y-20,0);y2<=min(y+20,20000);y2++){
			for(int x2=max(x-20,0);x2<=min(x+20,20000);x2++){
				if(f[y2][x2] && (x-x2)*(x-x2)+(y-y2)*(y-y2)<400){
					ok=false;
				}
			}
		}
		if(ok) f[y][x]=true, ans++;
	}
	printf("%d\n",ans);

	return 0;
}
0