Submission #943819

#TimeUsernameProblemLanguageResultExecution timeMemory
943819daoquanglinh2007Nicelines (RMI20_nicelines)C++17
11 / 100
2 ms512 KiB
#include <bits/stdc++.h> #include "nice_lines.h" using namespace std; const int LIM = 1e4, inf = 1e9+7; const long double EPS = 1e-9; void solve(int subtask_id, int N){ int l = -LIM, r = LIM, b = -inf, a = -inf; while (true){ if (r-l < 3){ for (int i = l; i <= r; i++) if (query(0, i) <= EPS){ b = i; break; } break; } int m1 = l+(r-l)/3, m2 = r-(r-l)/3; if (query(0, m1) > query(0, m2)) l = m1; else r = m2; } l = -2*LIM, r = 2*LIM; while (true){ if (r-l < 3){ for (int i = l; i <= r; i++) if (query(1, i) <= EPS){ a = i-b; break; } break; } int m1 = l+(r-l)/3, m2 = r-(r-l)/3; if (query(1, m1) > query(1, m2)) l = m1; else r = m2; } the_lines_are({a}, {b}); }
#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...