답안 #943152

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
943152 2024-03-11T08:44:58 Z vjudge1 Nicelines (RMI20_nicelines) C++17
84.7783 / 100
40 ms 708 KB
#include "nice_lines.h"
#include<bits/stdc++.h>
#define ll int
#define pll pair<ll, ll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ld long double
#define sz(a) ((ll)(a).size())
using namespace std;
mt19937_64 rng(170306);
ll random(ll l, ll r){return l+rng()%(r-l+1);}
const ld eps=1e-7;
void solve(ll subtask_id, ll n) 
{
    ll V=1e4, X=V*2+1;
    auto calc=[&](ld y){return query(X, y);};
    vector <ll> va, vb;
    function<void(ld, ld, ld, ld)> DnC=[&](ld l, ld r, ld fl, ld fr)
    {
        ld mid=(l+r)/2, fm=calc(mid);
        if (abs((fl+fr)/2-fm)<eps) return;
        if ((r-l)<1.0)
        {
            long double c=(calc(r+0.1)-fr-fl+calc(l-0.1))/2;
            long double d=sqrtl(max<long double>(0.0, 0.1*0.1-c*c));
            int a=round(d/c);
            if (mid<-eps) a=-a;
            int b=round(mid-X*a);
            va.push_back(a);
            vb.push_back(b);
            return;
        }
        DnC(l, mid, fl, fm), DnC(mid, r, fm, fr);
        return;
    };
    ld l=-V*X-V, r=V*X+V;
    if (n==3) l+=random(1, 10), r-=random(1, 10);
    DnC(l, r, calc(l), calc(r));
    the_lines_are(va, vb);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 444 KB Output is correct
2 Correct 1 ms 456 KB Output is correct
3 Correct 1 ms 460 KB Output is correct
4 Correct 1 ms 448 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 440 KB Output is correct
2 Correct 1 ms 700 KB Output is correct
3 Correct 2 ms 452 KB Output is correct
4 Correct 1 ms 708 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 452 KB Output is correct
2 Correct 2 ms 440 KB Output is correct
3 Correct 2 ms 456 KB Output is correct
4 Correct 2 ms 448 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 34 ms 456 KB Output is partially correct
2 Partially correct 29 ms 456 KB Output is partially correct
3 Partially correct 33 ms 448 KB Output is partially correct
4 Partially correct 32 ms 448 KB Output is partially correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 12 ms 456 KB Output is partially correct
2 Partially correct 12 ms 652 KB Output is partially correct
3 Partially correct 11 ms 444 KB Output is partially correct
4 Partially correct 10 ms 432 KB Output is partially correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 34 ms 456 KB Output is partially correct
2 Partially correct 29 ms 456 KB Output is partially correct
3 Partially correct 33 ms 448 KB Output is partially correct
4 Partially correct 32 ms 448 KB Output is partially correct
5 Partially correct 12 ms 456 KB Output is partially correct
6 Partially correct 12 ms 652 KB Output is partially correct
7 Partially correct 11 ms 444 KB Output is partially correct
8 Partially correct 10 ms 432 KB Output is partially correct
9 Partially correct 37 ms 452 KB Output is partially correct
10 Partially correct 40 ms 452 KB Output is partially correct
11 Partially correct 39 ms 452 KB Output is partially correct
12 Partially correct 35 ms 456 KB Output is partially correct