Submission #964111

#TimeUsernameProblemLanguageResultExecution timeMemory
964111dubabubaMobile (BOI12_mobile)C++14
0 / 100
1082 ms55432 KiB
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> pii; #define x first #define y second #define MP make_pair const int mxn = 1e6 + 10; pii P[mxn]; int n, l; bool can(double r) { vector<pair<double, double>> v; for(int i = 1; i <= n; i++) { pii &p = P[i]; double X = p.x; double Y = p.y; double sq = r * r - Y * Y; if(sq < 0) continue; sq = sqrt(sq); double f = X - sq, s = X + sq; if(f < 0) f = 0; if(s < 0) s = 0; if(f != s) v.push_back(MP(f, s)); } sort(v.begin(), v.end()); for(int i = 1; i < v.size(); i++) { if(v[i - 1].second < v[i].first) { if(v[i].first > 0.0) return 1; if(v[i - 1].second < (double) l) return 1; } } return 0; } int main() { cin >> n >> l; for(int i = 1; i <= n; i++) cin >> P[i].x >> P[i].y; double L = 0, R = 1e18; while(R - L > 0.0000001) { double M = (L + R) / 2; if(can(M)) L = M; else R = M; } printf("%.6lf\n", L); return 0; }

Compilation message (stderr)

mobile.cpp: In function 'bool can(double)':
mobile.cpp:31:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<double, double> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |  for(int i = 1; i < v.size(); i++) {
      |                 ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...