Submission #496608

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
4966082021-12-21 16:02:14ignaciocantaXylophone (JOI18_xylophone)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
void solve(int n) {
int low = 1, high = n;
while(high - low > 1){
int mid = low + (high - low) / 2;
if(query(1, mid) == n - 1) high = mid;
else low = mid;
}
int posN = high;
low = 1, high = n;
while(high - low > 1){
int mid = low + (high - low) / 2;
if(query(mid, n) == n - 1) low = mid;
else high = mid;
}
vector<set<int>> cands(n+1);
vector<bool> seen(n+1, 0), use(n+1, 0);
cands[posN].insert(n);
cands[low].insert(1);
int tot = 0;
while(tot < n){
int todo = -1;
for(int i = 1; i <= n; ++i){
if(int(cands[i].size()) == 1 && !use[i]){
todo = *cands[i].begin();
use[i] = 1;
//cout << "En " << i << " va " << todo << "\n";
answer(i, *cands[i].begin());
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

xylophone.cpp: In function 'void solve(int)':
xylophone.cpp:8:6: error: 'query' was not declared in this scope
    8 |   if(query(1, mid) == n - 1) high = mid;
      |      ^~~~~
xylophone.cpp:15:6: error: 'query' was not declared in this scope
   15 |   if(query(mid, n) == n - 1) low = mid;
      |      ^~~~~
xylophone.cpp:30:5: error: 'answer' was not declared in this scope
   30 |     answer(i, *cands[i].begin());
      |     ^~~~~~
xylophone.cpp:34:15: error: 'query' was not declared in this scope
   34 |      int r1 = query(i, i+1);
      |               ^~~~~
xylophone.cpp:43:15: error: 'query' was not declared in this scope
   43 |      int r1 = query(i-1, i);
      |               ^~~~~