結果
問題 |
No.202 1円玉投げ
|
ユーザー |
![]() |
提出日時 | 2016-10-04 18:09:16 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,207 bytes |
コンパイル時間 | 888 ms |
コンパイル使用メモリ | 72,316 KB |
実行使用メモリ | 16,968 KB |
最終ジャッジ日時 | 2024-12-22 10:40:05 |
合計ジャッジ時間 | 137,192 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 TLE * 21 |
ソースコード
#include <iostream> #include <cstdio> #include <string> #include <vector> #include <algorithm> #include <cmath> using namespace std; #define rep(i,n) for(int i=0;i<(n);i++) static const int mod = 1e9 + 7; int main(void){ int n; cin >> n; vector<pair<int, int> > center; rep(i, n){ // printf("i %d\n", i); int cx, cy; cin >> cx >> cy; if(center.size() != 0){ //x座標が近いものを探す sort(center.begin(), center.end()); int xl = cx - 21, xr = cx + 21; int yl = cy - 21, yr = cy + 21; auto it1 = lower_bound(center.begin(), center.end(), make_pair(xl, yl)); auto it2 = upper_bound(center.begin(), center.end(), make_pair(xr, yr)); bool flag = true; for(auto itr = it1; itr != it2; ++itr) { auto p = *itr; int nx = p.first, ny = p.second; // printf("%d %d\n", nx, ny); double len = sqrt((nx - cx) * (nx - cx) + (ny - cy) * (ny - cy)); // printf("len %f\n",len ); if(len < 20){ flag = false; break; } } if(flag)center.push_back(make_pair(cx, cy)); }else{ center.push_back(make_pair(cx, cy)); } } printf("%d\n", (int)center.size()); return 0; }