結果
| 問題 |
No.202 1円玉投げ
|
| コンテスト | |
| ユーザー |
koyopro
|
| 提出日時 | 2015-10-11 13:08:49 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 106 ms / 5,000 ms |
| コード長 | 1,049 bytes |
| コンパイル時間 | 1,624 ms |
| コンパイル使用メモリ | 164,816 KB |
| 実行使用メモリ | 36,052 KB |
| 最終ジャッジ日時 | 2024-12-22 10:00:27 |
| 合計ジャッジ時間 | 5,000 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 |
ソースコード
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(int i=0; i<(n); i++)
struct P { int x, y; P(){}; P(int _x, int _y): x(_x), y(_y){}; };
int N,T;
vector<int> M[1111][1111];
vector<P> ps;
int distance2(P a, P b) {
return pow(a.x - b.x, 2) + pow(a.y - b.y, 2);
}
signed main()
{
cin >> N;
int ans = 0;
int x,y;
REP(i,N) {
cin >> x >> y;
ps.push_back(P(x, y));
int mx = ps[i].x / 20;
int my = ps[i].y / 20;
int dxy9[] = {-1, 0, 1};
bool ok = true;
REP(k,9) {
int nx = mx + dxy9[k/3];
int ny = my + dxy9[k%3];
if (nx<0||ny<0) continue;
for (auto&& j : M[nx][ny]) {
if (distance2(ps[j], ps[i]) < 400) {
// conflict
ok = false;
break;
}
}
if (!ok) break;
}
if (ok) {
M[mx][my].push_back(i);
ans++;
}
}
cout << ans << endl;
return 0;
}
koyopro