#include"bits/stdc++.h"
using namespace std;
#define LL long long
#define MP make_pair
#define PB push_back
#include"park.h"
int n;
bool memo[1400][1400];
bool alreadey[1400][1400] = {};
bool great(int a, int b){ //a < b
if(already[a][b]) return memo[a][b];
already[a][b] = true;
int P[1400];
for(int i=0; i<n; i++) P[i] = 1;
P[a] = 0;
if(Ask(0, b, P) == 0) return memo[a][b] = true;
else return memo[a][b] = false;
}
void Detect(int T, int N){
if(T != 2) return;
n = N;
int p[1400];
p[0] = 0;
p[N-1] = N-1;
queue<pair<int,vector<int>>> que;
vector<int> v;
for(int i=1; i<N-1; i++) v.PB(i);
que.push(MP(1, v));
while(!que.empty()){
int left = que.front().first;
v = que.front().second;
que.pop();
vector<int> vSmall,vLarge;
for(int i=1; i<v.size(); i++){
if(great(v[0], v[i])) vLarge.PB(v[i]);
else vSmall.PB(v[i]);
}
p[left+vSmall.size()] = v[0];
if(vSmall.size() > 0) que.push(MP(left, vSmall));
if(vLarge.size() > 0) que.push(MP(left+vSmall.size()+1, vLarge));
}
//for(int i=0; i<N; i++) cout << p[i] << endl;
for(int i=0; i<N-1; i++) Answer(min(p[i], p[i+1]), max(p[i], p[i+1]));
}
Compilation message
park.cpp: In function 'bool great(int, int)':
park.cpp:13:5: error: 'already' was not declared in this scope
if(already[a][b]) return memo[a][b];
^~~~~~~
park.cpp:13:5: note: suggested alternative: 'alreadey'
if(already[a][b]) return memo[a][b];
^~~~~~~
alreadey
park.cpp:14:2: error: 'already' was not declared in this scope
already[a][b] = true;
^~~~~~~
park.cpp:14:2: note: suggested alternative: 'alreadey'
already[a][b] = true;
^~~~~~~
alreadey
park.cpp: In function 'void Detect(int, int)':
park.cpp:37:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=1; i<v.size(); i++){
~^~~~~~~~~