結果

問題 No.202 1円玉投げ
ユーザー sugim48sugim48
提出日時 2015-05-03 23:32:25
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 75 ms / 5,000 ms
コード長 1,390 bytes
コンパイル時間 643 ms
コンパイル使用メモリ 86,436 KB
実行使用メモリ 6,048 KB
最終ジャッジ日時 2023-08-23 21:30:43
合計ジャッジ時間 3,863 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
5,464 KB
testcase_01 AC 71 ms
6,048 KB
testcase_02 AC 3 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 6 ms
4,484 KB
testcase_06 AC 61 ms
5,676 KB
testcase_07 AC 70 ms
6,040 KB
testcase_08 AC 69 ms
6,040 KB
testcase_09 AC 37 ms
5,476 KB
testcase_10 AC 17 ms
4,964 KB
testcase_11 AC 32 ms
5,248 KB
testcase_12 AC 33 ms
5,152 KB
testcase_13 AC 19 ms
5,260 KB
testcase_14 AC 7 ms
4,556 KB
testcase_15 AC 37 ms
5,320 KB
testcase_16 AC 65 ms
5,356 KB
testcase_17 AC 64 ms
5,408 KB
testcase_18 AC 64 ms
5,516 KB
testcase_19 AC 34 ms
5,200 KB
testcase_20 AC 54 ms
5,720 KB
testcase_21 AC 34 ms
5,272 KB
testcase_22 AC 3 ms
4,380 KB
testcase_23 AC 3 ms
4,380 KB
testcase_24 AC 3 ms
4,404 KB
testcase_25 AC 2 ms
4,428 KB
testcase_26 AC 3 ms
4,376 KB
testcase_27 AC 3 ms
4,376 KB
testcase_28 AC 3 ms
4,388 KB
testcase_29 AC 3 ms
4,380 KB
testcase_30 AC 3 ms
4,560 KB
testcase_31 AC 2 ms
4,376 KB
testcase_32 AC 3 ms
4,376 KB
testcase_33 AC 3 ms
4,472 KB
testcase_34 AC 3 ms
4,412 KB
testcase_35 AC 66 ms
5,408 KB
testcase_36 AC 72 ms
5,508 KB
testcase_37 AC 74 ms
5,884 KB
testcase_38 AC 71 ms
5,404 KB
testcase_39 AC 3 ms
4,380 KB
testcase_40 AC 3 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

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