結果

問題 No.202 1円玉投げ
ユーザー 158b158b
提出日時 2015-06-11 02:52:35
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 84 ms / 5,000 ms
コード長 1,362 bytes
コンパイル時間 628 ms
コンパイル使用メモリ 84,864 KB
実行使用メモリ 6,148 KB
最終ジャッジ日時 2023-08-23 23:02:07
合計ジャッジ時間 3,529 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
5,416 KB
testcase_01 AC 74 ms
6,148 KB
testcase_02 AC 2 ms
4,500 KB
testcase_03 AC 2 ms
4,444 KB
testcase_04 AC 3 ms
4,380 KB
testcase_05 AC 6 ms
4,560 KB
testcase_06 AC 61 ms
5,628 KB
testcase_07 AC 69 ms
5,840 KB
testcase_08 AC 69 ms
5,736 KB
testcase_09 AC 39 ms
5,264 KB
testcase_10 AC 17 ms
4,888 KB
testcase_11 AC 33 ms
5,156 KB
testcase_12 AC 33 ms
5,176 KB
testcase_13 AC 18 ms
4,892 KB
testcase_14 AC 6 ms
4,500 KB
testcase_15 AC 36 ms
5,444 KB
testcase_16 AC 72 ms
5,540 KB
testcase_17 AC 71 ms
5,552 KB
testcase_18 AC 72 ms
5,508 KB
testcase_19 AC 35 ms
5,212 KB
testcase_20 AC 56 ms
5,520 KB
testcase_21 AC 34 ms
5,220 KB
testcase_22 AC 3 ms
4,444 KB
testcase_23 AC 3 ms
4,380 KB
testcase_24 AC 3 ms
4,556 KB
testcase_25 AC 3 ms
4,384 KB
testcase_26 AC 3 ms
4,380 KB
testcase_27 AC 3 ms
4,404 KB
testcase_28 AC 3 ms
4,380 KB
testcase_29 AC 3 ms
4,380 KB
testcase_30 AC 3 ms
4,376 KB
testcase_31 AC 3 ms
4,376 KB
testcase_32 AC 3 ms
4,392 KB
testcase_33 AC 3 ms
4,376 KB
testcase_34 AC 3 ms
4,380 KB
testcase_35 AC 78 ms
5,524 KB
testcase_36 AC 81 ms
5,400 KB
testcase_37 AC 73 ms
5,868 KB
testcase_38 AC 81 ms
5,660 KB
testcase_39 AC 3 ms
4,492 KB
testcase_40 AC 3 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <climits>
#include <vector>
#include <numeric>
#include <complex>
#include <map>
#include <bitset>
#include <utility>
using namespace std;

//#define __int64 long long
#define long __int64
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
const int Vecy[4] = {0,-1,0,1};
const int Vecx[4] = {1,0,-1,0};

const int Xy = 20000;
const int Pat = 100;
const int Kazu = Xy / Pat;
vector<vector<vector<pair<int,int> > > > field;
	
bool check(int testy, int testx){
	int fy = min(Kazu - 1, testy / Pat);
	int fx = min(Kazu - 1, testx / Pat);
	int kyori;
	
	for(int iy=max(0,fy-1); iy<=min(Kazu-1,fy+1); iy++){
		for(int ix=max(0,fx-1); ix<=min(Kazu-1, fx+1); ix++){
			for(int i=0; i<field[iy][ix].size(); i++){
				kyori = pow(testy - field[iy][ix][i].first , 2) + pow(testx - field[iy][ix][i].second , 2) + 0.2;
				if(kyori < 400){
					return false;
				}
			}
		}
	}
	
	//データ追加
	field[fy][fx].push_back(make_pair(testy, testx));
	
	return true;
}

int main(){
	int n;
	int ans = 0;
	int y,x;
	
	//vector
	field = vector<vector<vector<pair<int,int> > > >(Kazu, vector<vector<pair<int,int> > >(Kazu, vector<pair<int,int> >()));
	
	cin >> n;
	rep(i,n){
		cin >> x >> y;
		if(check(y,x)){
			ans ++;
		}
	}
	
	cout << ans << endl;
    
    return 0;
}
0