結果

問題 No.202 1円玉投げ
ユーザー Lay_ec
提出日時 2015-05-04 00:59:00
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 733 bytes
コンパイル時間 1,093 ms
コンパイル使用メモリ 85,716 KB
実行使用メモリ 11,264 KB
最終ジャッジ日時 2024-12-22 08:00:44
合計ジャッジ時間 60,549 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 37 TLE * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:25:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   25 |         scanf("%d",&n);
      |         ~~~~~^~~~~~~~~
main.cpp:29:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   29 |                 scanf("%d%d",&x,&y);
      |                 ~~~~~^~~~~~~~~~~~~~

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <set>
#include <sstream>
#include <map>
#include <queue>
#include <stack>

using namespace std;


int main()
{
		
	set<pair<int,int> > coin;

	int n;
	scanf("%d",&n);
	long res=0;
	for(int i=0;i<n;i++){
		int x,y;
		scanf("%d%d",&x,&y);
		
		bool ok=true;
		for(int dx=-19;dx<=19 && ok;dx++){
			for(int dy=-19 ; dy<=19 && ok;dy++){
				if(dx*dx+dy*dy>=400) continue;
				
				int nx=x+dx,ny=y+dy;
				if(coin.find(make_pair(nx,ny))!=coin.end()) ok=false;			

			}
		}
		if(ok){res++; coin.insert(make_pair(x,y));}
		
	}
	
	cout<<res<<endl;

	return 0;
}
0