結果
問題 |
No.202 1円玉投げ
|
ユーザー |
![]() |
提出日時 | 2015-06-01 01:06:05 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,769 bytes |
コンパイル時間 | 958 ms |
コンパイル使用メモリ | 82,692 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-22 09:26:26 |
合計ジャッジ時間 | 48,368 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 37 TLE * 1 |
ソースコード
#include <cassert> #include <functional> #include <set> #include <ctime> #include <cmath> #include <climits> #include <string> #include <queue> #include <map> #include <vector> #include <algorithm> #include <iostream> #include <cstdio> #ifndef ONLINE_JUDGE //POJ # include <random> # include <array> # define mkt make_tuple # define empb emplace_back #endif #ifdef _LOCAL # include "for_local.h" #endif using namespace std; typedef unsigned int uint; typedef unsigned long long ull; #define repi(_I, _B, _E) for(int _I = (_B); (_I) < (_E); ++ (_I)) #define rep(_I, _N) for(int _I = 0; (_I) < (_N); ++ (_I)) #define mkp make_pair #define all(_X) (_X).begin(), (_X).end() #define scani(_V) std::scanf("%d", &_V) #define printi(_V) std::printf("%d", static_cast<int>(_V)) template<typename T> T selfprod(T const& x, T const& y) { return x * x + y * y; } signed main() { int n; cin >> n; int k = 0; vector<pair<int, int>> ps; vector<pair<int, int>> xs, ys; rep(i, n) { int x, y; cin >> x >> y; bool ok = true; vector<bool> vb(n, false); auto&& ranx = mkp(upper_bound(all(xs), mkp(x - 20, 0)), lower_bound(all(xs), mkp(x + 20, 0))); auto&& rany = mkp(upper_bound(all(ys), mkp(y - 20, 0)), lower_bound(all(ys), mkp(y + 20, 0))); for ( auto it = ranx.first; it != ranx.second; ++it ) { vb[it->second] = true; } for ( auto it = rany.first; it != rany.second; ++it ) { if ( vb[it->second] ) { auto const& p = ps[it->second]; if ( selfprod(x - p.first, y - p.second) < ((10*2)*(10*2)) ) { ok = false; break; } } } if ( ok ) { ps.emplace_back(x, y); xs.emplace(lower_bound(all(xs), mkp(x, k)), mkp(x, k)); ys.emplace(lower_bound(all(ys), mkp(y, k)), mkp(y, k)); ++k; } } cout << k << endl; return 0; }