Submission #1366927

#TimeUsernameProblemLanguageResultExecution timeMemory
1366927faricaChameleon's Love (JOI20_chameleon)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>

using namespace std;
using vi = vector<int>;
using pi = pair<int,int>;
using ll = long long;

void Solve(int N) {
    vector<bool>fnd(2*N+1, 0);
    for(int i=1; i<=2*N; ++i) {
        if(fnd[i]) continue;
        vi vec;
        for(int j=i+1; j<=2*N; ++j) {
            if(!fnd[j]) vec.push_back(j);
        }
        int siz = (int)vec.size(), l = 0, r = siz-1;
        while(l < r) {
            int m = (l+r)/2;
            vi p;
            for(int j=0; j<m; ++j) p.push_back(vec[j]);
            vi p2(p.begin(), p.end());
            p2.push_back(i);
            int res1 = Query(p), res2 = Query(p2);
            if(res1 == res2) r = m;
            else l = m+1;
        }
        Answer(i, r);
        fnd[i] = fnd[r] = 1;
    }
}

Compilation message (stderr)

chameleon.cpp: In function 'void Solve(int)':
chameleon.cpp:23:24: error: 'Query' was not declared in this scope
   23 |             int res1 = Query(p), res2 = Query(p2);
      |                        ^~~~~
chameleon.cpp:24:24: error: 'res2' was not declared in this scope; did you mean 'res1'?
   24 |             if(res1 == res2) r = m;
      |                        ^~~~
      |                        res1
chameleon.cpp:27:9: error: 'Answer' was not declared in this scope
   27 |         Answer(i, r);
      |         ^~~~~~