結果
問題 | No.202 1円玉投げ |
ユーザー |
|
提出日時 | 2020-05-22 02:41:39 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 199 ms / 5,000 ms |
コード長 | 1,089 bytes |
コンパイル時間 | 1,885 ms |
コンパイル使用メモリ | 176,568 KB |
実行使用メモリ | 7,424 KB |
最終ジャッジ日時 | 2024-12-22 11:57:48 |
合計ジャッジ時間 | 5,227 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 38 |
ソースコード
#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); map<ll, vector<int> > memo; int ans = 0; for (int i = 0; i < n; i++) { cin >> x[i] >> y[i]; auto it = memo.upper_bound(x[i] - 20); bool f = true; while (it != memo.end()) { if (it->first >= x[i] + 20) break; auto& v = it->second; int jj = 0; while (jj < v.size()) { int j = v[jj]; ll dx = x[i] - x[j]; ll dy = y[i] - y[j]; ll r2 = dx * dx + dy * dy; if (r2 >= 400) { ++jj; continue; } f = false; break; } if (!f) break; ++it; } if (f) { ++ans; memo[x[i]].push_back(i); } } cout << ans << newl; return 0; }