제출 #920891

#제출 시각아이디문제언어결과실행 시간메모리
920891Kams7Mobile (BOI12_mobile)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long double dist(double k, ll y){ if (k<y) return -1; return sqrt(k*k - y*y); } bool check(ll n, double k, ll l, vector<pair<ll,ll>> v){ double mn = 0; for (ll i=0; i<n; i++){ ll x = v[i].first, y = v[i].second; double d = dist(k, y); if (d==-1) continue; if (x-d<=mn) mn = max(mn, x+d); } return mn>=l; } void solve(){ ll n, len; cin >> n >> len; map<ll, ll> ys; for (ll i=0; i<n; i++){ ll x, y; cin >> x >> y; if (ys.find(x) == ys.end()) ys[x] = abs(y); else ys[x] = min(ys[x], abs(y)); } vector<pair<ll, ll>> v; for (auto el: ys){ v.push_back(make_pair(el.first, el.second)); } sort(v.begin(), v.end()); n = size(v); double l=0, r=1.5e9; while (r-l>1e-4){ double mid = ((l+r)/2); if (check(n, mid, len, v)) r=mid; else l=mid; } cout << l << "\n"; } int main() { std::ios::sync_with_stdio(false); std::cin.tie(NULL); // your code goes here // int t; // cin >> t; // while (t--) solve(); }

컴파일 시 표준 에러 (stderr) 메시지

mobile.cpp: In function 'void solve()':
mobile.cpp:34:9: error: 'size' was not declared in this scope; did you mean 'dysize'?
   34 |     n = size(v);
      |         ^~~~
      |         dysize