結果

問題 No.202 1円玉投げ
ユーザー kotatsugame
提出日時 2020-03-01 17:33:52
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 98 ms / 5,000 ms
コード長 553 bytes
コンパイル時間 907 ms
コンパイル使用メモリ 73,552 KB
実行使用メモリ 30,140 KB
最終ジャッジ日時 2024-12-22 11:50:36
合計ジャッジ時間 4,088 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 38
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:7:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    7 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int N;
vector<pair<int,int> >A[1001][1001];
main()
{
	cin>>N;
	int ans=0;
	for(;N--;)
	{
		int x,y;cin>>x>>y;
		bool ok=true;
		for(int lx=max(0,x/20-1),rx=min(1000,x/20+1);lx<=rx;lx++)
		{
			for(int ly=max(0,y/20-1),ry=min(1000,y/20+1);ly<=ry;ly++)
			{
				for(pair<int,int>p:A[lx][ly])
				{
					int dx=p.first-x,dy=p.second-y;
					if(dx*dx+dy*dy<400)ok=false;
				}
			}
		}
		if(ok)
		{
			ans++;
			A[x/20][y/20].push_back(make_pair(x,y));
		}
	}
	cout<<ans<<endl;
}
0