Submission #906195

#TimeUsernameProblemLanguageResultExecution timeMemory
906195MikhailMobile (BOI12_mobile)C++14
8 / 100
786 ms16168 KiB
#include <iostream> #include <math.h> #define MAX_N 1000000 double x[MAX_N], y[MAX_N]; #define MAX(a,b) ((a > b) ? a : b) using namespace std; int main() { int N; cin >> N; double L; cin >> L; cin >> x[0] >> y[0]; y[0] = y[0] * y[0]; int ni = 1; for (int i = 1; i < N; i++) { cin >> x[ni] >> y[ni]; if (x[ni] == x[ni - 1]) { if (y[ni] * y[ni] < y[ni - 1]) { x[ni - 1] = x[ni]; y[ni - 1] = y[ni] * y[ni]; } } else { y[ni] = y[ni] * y[ni]; ni++; } } double l = 0., m, r = 1e9, m_sqr, c, t0, tn; while(r - l > 0.0009) { m = l / 2 + r / 2; m_sqr = m * m; c = 0.; for (int j = 0; j < ni; j++) { if (m_sqr < y[j]) continue; t0 = sqrt(m_sqr - y[j]); tn = x[j] - t0; if (tn > c) continue; t0 += x[j]; c = MAX(t0, c); } //cout << c << ' ' << l << ' ' << r << ' ' << min_t << '\n'; if (c > L) r = m; else l = m; } cout << l / 2 + r / 2 << '\n'; return 0; }
#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...