結果
問題 |
No.202 1円玉投げ
|
ユーザー |
|
提出日時 | 2020-05-22 02:29:50 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,110 bytes |
コンパイル時間 | 1,922 ms |
コンパイル使用メモリ | 176,520 KB |
実行使用メモリ | 5,760 KB |
最終ジャッジ日時 | 2024-12-22 11:57:42 |
合計ジャッジ時間 | 4,966 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 WA * 18 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; constexpr char newl = '\n'; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int n; cin >> n; vector<ll> x(n), y(n); for (int i = 0; i < n; i++) { cin >> x[i] >> y[i]; } vector<int> ids(n); iota(ids.begin(), ids.end(), 0); sort(ids.begin(), ids.end(), [&](int i1, int i2){ return x[i1] < x[i2]; }); deque<int> dq; for (int i : ids) { for (int jj = 0; ;) { if (jj >= dq.size()) { dq.push_front(i); break; } int& j = dq[jj]; ll dx = x[i] - x[j]; if (abs(dx) >= 20) { dq.push_front(i); break; } ll dy = y[i] - y[j]; ll r2 = dx * dx + dy * dy; if (r2 >= 400) { ++jj; continue; } if (i > j) break; swap(j, dq.back()); dq.pop_back(); } } cout << dq.size() << newl; return 0; }