Submission #1181610

#TimeUsernameProblemLanguageResultExecution timeMemory
1181610AMnuMinerals (JOI19_minerals)C++20
Compilation error
0 ms0 KiB
// #include "minerals.h"
#include <bits/stdc++.h>
using namespace std;

const int MAXN = 9e4;

int last, P, L[MAXN], R[MAXN];
bool in[MAXN], rig;
vector <int> V[2], mid[MAXN];

// is the pair of x inside?
bool check(int x) {
    int cur = Query(x);
    in[x] = !in[x];
    if (cur == last) {
        return true;
    }
    last = cur;
    return false;
}

void Solve(int N) {
    for (int i=1;i<=2*N;i++) {
        bool x = check(i);
        if (x) {
            int j = V[1].size();
            L[j] = 0;
            R[j] = V[0].size()-1;
            if (L[j] == R[j]) {
                Answer(V[0][L[j]],i);
                P++;
            }
            else {
                mid[(L[j]+R[j])/2].push_back(j);
            }
        }
        V[x].push_back(i);
    }
    while (P < N) {
        rig = !rig;
        for (int i=0;i<N;i++) {
            check(V[0][i]);
            for (int j : mid[i]) {
                if (check(j)^rig) {
                    R[j] = i;
                }
                else {
                    L[j] = i+1;
                }
                if (L[j] == R[j]) {
                    Answer(V[0][L[j]],V[1][j]);
                    P++;
                }
                else {
                    mid[(L[j]+R[j])/2].push_back(j);
                }
            }
            mid[i].clear();
        }
    }
}










Compilation message (stderr)

minerals.cpp: In function 'bool check(int)':
minerals.cpp:13:15: error: 'Query' was not declared in this scope
   13 |     int cur = Query(x);
      |               ^~~~~
minerals.cpp: In function 'void Solve(int)':
minerals.cpp:30:17: error: 'Answer' was not declared in this scope
   30 |                 Answer(V[0][L[j]],i);
      |                 ^~~~~~
minerals.cpp:51:21: error: 'Answer' was not declared in this scope
   51 |                     Answer(V[0][L[j]],V[1][j]);
      |                     ^~~~~~