Submission #597415

#TimeUsernameProblemLanguageResultExecution timeMemory
597415definitelynotmeeNicelines (RMI20_nicelines)C++17
11 / 100
3 ms208 KiB
#include <stdio.h> #include<bits/stdc++.h> #define ff first #define ss second #define all(x) x.begin(), x.end() using namespace std; using ll = long long; using pii = pair<int,int>; using pll = pair<ll,ll>; template<typename t> using matrix = vector<vector<t>>; #include "nice_lines.h" const long double EPS = 1e-10; void solve(int subtask_id, int N) { if(N > 1) return; int ini = -1e4, fim = 1e4; while(ini!=fim){ int m = (ini+fim+1)>>1; long double q1 = query(0,m-1), q2 = query(0,m); if(q2 <= q1) ini = m; else fim = m-1; } int y = ini; long double l = -1e4, r = 1e4; while(r-l > EPS){ long double m1 = (r-l)/3+l; long double m2 = 2*(r-l)/3+l; if(query(m2,0) <= query(m1,0)) l = m1; else r = m2; } // x = -b/a <=> a = -b/x int a = round(-y/l); the_lines_are({a}, {y}); }
#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...