Submission #739524

#TimeUsernameProblemLanguageResultExecution timeMemory
739524Kirill22Nicelines (RMI20_nicelines)C++17
0 / 100
128 ms312 KiB
#include "nice_lines.h" #include "bits/stdc++.h" using namespace std; long double query(long double x, long double y); void the_lines_are(std::vector<int> a, std::vector<int> b); void solve(int subtask_id, int N) { int x = (1 << 16); vector<int> res; function<void(int, int)> solve = [&] (int l, int r) { if (r - l < 2) { return; } int m = (l + r) / 2; if (abs(query(x, m) * 2 - query(x, l) - query(x, r)) < 1e-4) { return; } if (abs(query(x, m) * 2 - query(x, m + 1) - query(x, m - 1)) > 1e-4) { res.push_back(m); } solve(l, m); solve(m, r); }; solve(-x * (1 << 10), x * (1 << 10)); vector<int> a, b; for (int i = 0; i < N; i++) { int y = res[i] % x; if (y >= x / 2) { y -= x; } b.push_back(y); a.push_back((res[i] - y) / x); } 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...