結果
| 問題 |
No.202 1円玉投げ
|
| コンテスト | |
| ユーザー |
airis
|
| 提出日時 | 2015-05-04 00:33:43 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 83 ms / 5,000 ms |
| コード長 | 1,486 bytes |
| コンパイル時間 | 884 ms |
| コンパイル使用メモリ | 80,888 KB |
| 実行使用メモリ | 7,040 KB |
| 最終ジャッジ日時 | 2024-12-22 07:34:59 |
| 合計ジャッジ時間 | 3,508 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 |
ソースコード
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <numeric>
#define rep(x, to) for (int x = 0; x < (to); x++)
#define REP(x, a, to) for (int x = (a); x < (to); x++)
#define foreach(itr, x) for (typeof((x).begin()) itr = (x).begin(); itr != (x).end(); itr++)
#define sq(x) ((x) * (x))
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
const int BOX_N = 205;
int N;
int X[100005];
int Y[100005];
vector< vector< vector<PII> > > box(BOX_N);
int ans;
int mx[] = {1, 1, 0, -1, -1, -1, 0, 1};
int my[] = {0, 1, 1, 1, 0, -1,-1,-1};
int dist(PII a, PII b) {
return sq(a.first - b.first) + sq(a.second - b.second);
}
void solve(int x, int y) {
int bx = x / 100;
int by = y / 100;
bool add = true;
//着目
{
rep(i, box[by][bx].size()) {
if (dist(box[by][bx][i], PII(y, x)) < 400) {
add = false;
}
}
}
//着目近傍
rep(k, 8) {
int nx = bx + mx[k];
int ny = by + my[k];
if (nx < 0 || ny < 0) continue;
rep(i, box[ny][nx].size()) {
if (dist(box[ny][nx][i], PII(y, x)) < 400) {
add = false;
}
}
}
if (add) {
box[by][bx].push_back(PII(y, x));
ans++;
}
}
int main() {
rep(i, BOX_N) box[i].resize(BOX_N);
cin >> N;
rep(i, N) {
cin >> X[i] >> Y[i];
solve(X[i], Y[i]);
}
cout << ans << endl;
return 0;
}
airis