Submission #503935

#TimeUsernameProblemLanguageResultExecution timeMemory
503935Abrar_Al_SamitXylophone (JOI18_xylophone)C++17
Compilation error
0 ms0 KiB
#include "xylophone.h"
#include <bits/stdc++.h>
#include "grader.cpp"
using namespace std;




void solve(int N) {
  int p = 2;
  while(query(p, N)==N-1) {
    ++p;
  }
  --p;
  int ans[n+1];
  for(int i=1; i<=N; ++i) {
    if(i==p) {
      ans[i] = 1;
    } else {
      ans[i] = 1+query(1, p);
    }
  }
  for(int i=1; i<=N; ++i) {
    answer(i, ans[i]);
  }
}

Compilation message (stderr)

xylophone.cpp: In function 'void solve(int)':
xylophone.cpp:15:11: error: 'n' was not declared in this scope
   15 |   int ans[n+1];
      |           ^
xylophone.cpp:18:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
   18 |       ans[i] = 1;
      |       ^~~
      |       abs
xylophone.cpp:20:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
   20 |       ans[i] = 1+query(1, p);
      |       ^~~
      |       abs
xylophone.cpp:24:15: error: 'ans' was not declared in this scope; did you mean 'abs'?
   24 |     answer(i, ans[i]);
      |               ^~~
      |               abs