Submission #943127

# Submission time Handle Problem Language Result Execution time Memory
943127 2024-03-11T08:35:46 Z Tuanlinh123 Nicelines (RMI20_nicelines) C++17
0 / 100
30 ms 704 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;

const ld eps=1e-7;
void solve(ll subtask_id, ll n) 
{
    ll V=1e4, X=V*3;
    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)
        {
            ll val=0;
            if (l<=round(l)<=r) val=round(l);
            if (l<=round(r)<=r) val=round(r);
            ll b=val%X, a=(val-b)/X;
            if (b<0) b+=X, a--;
            if (b>V) b-=X, a++;
            va.pb(a), vb.pb(b);
            return;
        }
        DnC(l, mid, fl, fm), DnC(mid, r, fm, fr);
        return;
    };
    ld l=-3e8-2e4, r=3e8+2e4;
    DnC(l, r, calc(l), calc(r));
    the_lines_are(va, vb);
}

Compilation message

nicelines.cpp: In lambda function:
nicelines.cpp:26:18: warning: comparisons like 'X<=Y<=Z' do not have their mathematical meaning [-Wparentheses]
   26 |             if (l<=round(l)<=r) val=round(l);
      |                 ~^~~~~~~~~~
nicelines.cpp:27:18: warning: comparisons like 'X<=Y<=Z' do not have their mathematical meaning [-Wparentheses]
   27 |             if (l<=round(r)<=r) val=round(r);
      |                 ~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 452 KB Output is correct
2 Correct 1 ms 444 KB Output is correct
3 Incorrect 1 ms 452 KB Incorrect
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 444 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 704 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 30 ms 452 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 444 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 30 ms 452 KB Incorrect
2 Halted 0 ms 0 KB -