Submission #960580

# Submission time Handle Problem Language Result Execution time Memory
960580 2024-04-10T16:08:47 Z Tuanlinh123 Minerals (JOI19_minerals) C++17
Compilation error
0 ms 0 KB
#include "minerals.h"
#include<bits/stdc++.h>
#define ll int
#define pb push_back
#define sz(a) ((ll)(a).size())
using namespace std;

void Solve(int n, ll crr=0) 
{
    vector <ll> A, B, a(n*2+1, 0);
    auto flip=[&](ll idx)
    {
        ll x=Query(idx)-crr;
        crr+=x, a[idx]^=1; return x;
    };
    for (ll i=1; i<=n*2; i++) (flip(i)?A:B).pb(i);
    function <void(vector <ll>, vector <ll>, bool)> 
    solve=[&](vector <ll> L, vector <ll> R, bool cr)
    {
        ll n=sz(L);
        if (n==1) {Answer(L[0], R[0]); return;}
        vector <ll> left, right;
        ll len=max(1.0, 0.4*n);
        for (ll i=0; i<len; i++) flip(L[i]);
        for (ll i:R)
        {
            if (sz(left)==len) right.pb(i);
            else if (sz(right)==len) left.pb(i);
            else (a[i]^(a[i]+flip(i))^cr?right:left).pb(i);
        } 
        solve(vector <ll> (L.begin(), L.begin()+len), left, cr^1);
        solve(vector <ll> (L.begin()+len, L.end()), right, cr);
    }; solve(A, B, 1);
}

Compilation message

/usr/bin/ld: /tmp/ccfXsHX0.o: in function `main':
grader.cpp:(.text.startup+0xbd): undefined reference to `Solve(int)'
collect2: error: ld returned 1 exit status