結果

問題 No.202 1円玉投げ
ユーザー tkmst201tkmst201
提出日時 2017-05-20 17:18:20
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 136 ms / 5,000 ms
コード長 1,152 bytes
コンパイル時間 1,170 ms
コンパイル使用メモリ 149,516 KB
実行使用メモリ 9,152 KB
最終ジャッジ日時 2023-08-23 23:31:51
合計ジャッジ時間 4,382 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
9,132 KB
testcase_01 AC 95 ms
9,008 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 3 ms
4,480 KB
testcase_05 AC 6 ms
4,768 KB
testcase_06 AC 109 ms
7,872 KB
testcase_07 AC 126 ms
8,168 KB
testcase_08 AC 125 ms
8,276 KB
testcase_09 AC 60 ms
6,684 KB
testcase_10 AC 21 ms
5,348 KB
testcase_11 AC 47 ms
6,236 KB
testcase_12 AC 48 ms
6,276 KB
testcase_13 AC 23 ms
5,528 KB
testcase_14 AC 6 ms
4,760 KB
testcase_15 AC 58 ms
6,524 KB
testcase_16 AC 42 ms
9,108 KB
testcase_17 AC 51 ms
9,108 KB
testcase_18 AC 51 ms
9,024 KB
testcase_19 AC 53 ms
6,520 KB
testcase_20 AC 94 ms
7,500 KB
testcase_21 AC 53 ms
6,440 KB
testcase_22 AC 3 ms
4,380 KB
testcase_23 AC 3 ms
4,424 KB
testcase_24 AC 2 ms
4,500 KB
testcase_25 AC 3 ms
4,464 KB
testcase_26 AC 3 ms
4,376 KB
testcase_27 AC 2 ms
4,384 KB
testcase_28 AC 3 ms
4,432 KB
testcase_29 AC 2 ms
4,556 KB
testcase_30 AC 2 ms
4,404 KB
testcase_31 AC 3 ms
4,400 KB
testcase_32 AC 3 ms
4,592 KB
testcase_33 AC 3 ms
4,468 KB
testcase_34 AC 2 ms
4,472 KB
testcase_35 AC 53 ms
9,152 KB
testcase_36 AC 48 ms
9,132 KB
testcase_37 AC 136 ms
8,432 KB
testcase_38 AC 56 ms
9,128 KB
testcase_39 AC 2 ms
4,380 KB
testcase_40 AC 2 ms
4,484 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> P;

const ll INF = 1ll<<60;
const ll MOD = 1000000007;
const double EPS  = 1e-10;

int n;
set<int> sx[20001];

int main() {
	cin >> n;
	
	int ans = 0;
	
	REP(i, n) {
		int x, y;
		scanf("%d %d", &x, &y);
		
		bool ok = true;
		
		FOR(j, -20, 21) {
			if (!ok) break;
			
			int nx = x + j;
			
			if (nx >= 0 && nx <= 20000) {
				set<int>::iterator it = sx[nx].lower_bound(y - 20);
				
				while (ok && it != sx[nx].end() && *it <= y + 20) {
					ll d = (x - nx) * (x - nx) + (y - *it) * (y - *it);
					
					if (d < 400) ok = false;
					it++;
				}
			}
		}
		
		if (ok) {
			ans++;
			sx[x].insert(y);
		}
	}
	
	cout << ans << endl;
	
	return 0;
}
0