結果

問題 No.202 1円玉投げ
ユーザー sugim48
提出日時 2015-05-03 23:32:25
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 86 ms / 5,000 ms
コード長 1,390 bytes
コンパイル時間 1,179 ms
コンパイル使用メモリ 88,036 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-22 06:09:24
合計ジャッジ時間 4,383 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 38
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <fstream>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

vector<int> a[201][201];

bool f(int x1, int y1, int x2, int y2) {
	int dx = x1 - x2, dy = y1 - y2;
	return dx * dx + dy * dy < 20 * 20;
}

int main() {
	int N; cin >> N;
	vector<int> X(N), Y(N);
	int cnt = 0;
	for (int i = 0; i < N; i++) {
		cin >> X[i] >> Y[i];
		int x = X[i] / 100, y = Y[i] / 100;
		bool ok = true;
		for (int dy = -1; dy <= 1; dy++)
			for (int dx = -1; dx <= 1; dx++) {
				int _x = x + dx, _y = y + dy;
				if (_x >= 0 && _x <= 200 && _y >= 0 && _y <= 200) {
					for (int k = 0; k < a[_y][_x].size(); k++) {
						int j = a[_y][_x][k];
						if (f(X[i], Y[i], X[j], Y[j]))
							ok = false;
					}
				}
			}
		if (ok) {
			a[y][x].push_back(i);
			cnt++;
		}
	}
	cout << cnt << endl;
}
0