Submission #597415

# Submission time Handle Problem Language Result Execution time Memory
597415 2022-07-16T01:16:22 Z definitelynotmee Nicelines (RMI20_nicelines) C++17
11 / 100
3 ms 208 KB
#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 time Memory Grader output
1 Correct 2 ms 208 KB Output is correct
2 Correct 3 ms 208 KB Output is correct
3 Correct 3 ms 208 KB Output is correct
4 Correct 3 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -