結果
| 問題 |
No.202 1円玉投げ
|
| コンテスト | |
| ユーザー |
cormoran
|
| 提出日時 | 2016-10-04 18:56:08 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 400 ms / 5,000 ms |
| コード長 | 1,355 bytes |
| コンパイル時間 | 2,082 ms |
| コンパイル使用メモリ | 177,796 KB |
| 実行使用メモリ | 14,976 KB |
| 最終ジャッジ日時 | 2024-12-22 10:49:22 |
| 合計ジャッジ時間 | 7,853 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using pii = pair<int,int>;
using ll = long long;
#define rep(i, j) for(int i=0; i < (int)(j); i++)
#define repeat(i, j, k) for(int i = (j); i < (int)(k); i++)
class Solver {
public:
bool cross(pii a, pii b) {
return pow(a.first - b.first, 2) + pow(a.second - b.second, 2) < 20 * 20;
}
bool solve() {
int N; cin >> N;
vector<int> X(N), Y(N);
rep(i, N) cin >> X[i] >> Y[i];
map<int, map<int, vector<pii>>> G;
int ans = 0;
rep(i, N) {
int x = X[i], y = Y[i];
int gx = x / 10, gy = y / 10;
repeat(dgy, -2, 2 + 1) {
if(G.count(gy + dgy)) {
repeat(dgx, -2, 2 + 1) {
if(G[gy + dgy].count(gx + dgx)) {
for(pii p : G[gy + dgy][gx + dgx]) {
if(cross(p, make_pair(y, x))) goto FAIL;
}
}
}
}
}
G[gy][gx].push_back(make_pair(y, x));
ans++;
FAIL:;
}
cout << ans << endl;
return 0;
}
};
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
Solver s;
s.solve();
return 0;
}
cormoran