Submission #750947

# Submission time Handle Problem Language Result Execution time Memory
750947 2023-05-30T16:30:26 Z doowey Nicelines (RMI20_nicelines) C++17
85.8155 / 100
61 ms 304 KB
#include <bits/stdc++.h>
#include "nice_lines.h"

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;

#define fi first
#define se second
#define mp make_pair

const int X = (int)2e4 + 4;
const int B = 10000 * 1ll * X + 1;
const ld EPS = 1e-5;

ld g(ll x){
    return query(X, x) - query(X, x - 1);
}


vector<int> aa, bb;


void go(ll l, ll r, ld gl, ld gr){
    if(abs(gl-gr) < EPS)  return;
    if(l + 1 == r){
        int B = (l % X + X) % X;
        if(B > (int)1e4) B = -(X - B);
        int A = (l - B) / X;
        aa.push_back(A);
        bb.push_back(B);
        return;
    }
    ll mid = l + (r - l) / 2ll;
    ld gm = g(mid);
    if(abs(gm-gl) > EPS){
        go(l, mid, gl, gm);
    }
    if(abs(gm-gr) > EPS){
        go(mid, r, gm, gr);
    }
}

void solve(int _id, int _n){
    go(-B, +B, g(-B), g(+B));
    the_lines_are(aa, bb);
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 1 ms 304 KB Output is correct
3 Correct 2 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 304 KB Output is correct
2 Correct 2 ms 208 KB Output is correct
3 Correct 2 ms 208 KB Output is correct
4 Correct 2 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 208 KB Output is correct
2 Correct 2 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 Partially correct 56 ms 300 KB Output is partially correct
2 Partially correct 41 ms 208 KB Output is partially correct
3 Partially correct 53 ms 292 KB Output is partially correct
4 Partially correct 59 ms 296 KB Output is partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 22 ms 208 KB Output is partially correct
2 Partially correct 16 ms 300 KB Output is partially correct
3 Partially correct 21 ms 208 KB Output is partially correct
4 Partially correct 20 ms 208 KB Output is partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 56 ms 300 KB Output is partially correct
2 Partially correct 41 ms 208 KB Output is partially correct
3 Partially correct 53 ms 292 KB Output is partially correct
4 Partially correct 59 ms 296 KB Output is partially correct
5 Partially correct 22 ms 208 KB Output is partially correct
6 Partially correct 16 ms 300 KB Output is partially correct
7 Partially correct 21 ms 208 KB Output is partially correct
8 Partially correct 20 ms 208 KB Output is partially correct
9 Partially correct 51 ms 296 KB Output is partially correct
10 Partially correct 61 ms 292 KB Output is partially correct
11 Partially correct 55 ms 292 KB Output is partially correct
12 Partially correct 38 ms 208 KB Output is partially correct