Submission #255414

#TimeUsernameProblemLanguageResultExecution timeMemory
255414ChrisTXylophone (JOI18_xylophone)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include "xylophone.h" using namespace std; bool same[MN]; int diff[MN]; void solve (int n) { for (int i = 1; i < n; i++) diff[i] = query(i,i+1); for (int i = 1; i + 1 < n; i++) same[i+1] = query(i,i+2) == diff[i] + diff[i+1]; for (int ree = 0; ree <= 1; ree++) { int lt = ree; vector<int> perm(n+1); for (int st = 1; st <= n; st++) { lt = ree; perm[1] = st; for (int j = 2; j <= n; j++) { if (lt) perm[j] = perm[j-1] - diff[j-1]; else perm[j] = perm[j-1] + diff[j-1]; if (perm[j] < 1 || perm[j] > n) goto fail; lt ^= same[j] ^ 1; } for (int i = 1; i <= n; i++) { if (perm[i] == 1) break; if (perm[i] == n) goto fail; } for (int i = 1; i <= n; i++) answer(i,perm[i]); return; fail:; } } assert(0); }

Compilation message (stderr)

xylophone.cpp:4:11: error: 'MN' was not declared in this scope
 bool same[MN]; int diff[MN];
           ^~
xylophone.cpp:4:25: error: 'MN' was not declared in this scope
 bool same[MN]; int diff[MN];
                         ^~
xylophone.cpp: In function 'void solve(int)':
xylophone.cpp:6:30: error: 'diff' was not declared in this scope
  for (int i = 1; i < n; i++) diff[i] = query(i,i+1);
                              ^~~~
xylophone.cpp:6:30: note: suggested alternative: 'div'
  for (int i = 1; i < n; i++) diff[i] = query(i,i+1);
                              ^~~~
                              div
xylophone.cpp:7:34: error: 'same' was not declared in this scope
  for (int i = 1; i + 1 < n; i++) same[i+1] = query(i,i+2) == diff[i] + diff[i+1];
                                  ^~~~
xylophone.cpp:7:34: note: suggested alternative: 'stime'
  for (int i = 1; i + 1 < n; i++) same[i+1] = query(i,i+2) == diff[i] + diff[i+1];
                                  ^~~~
                                  stime
xylophone.cpp:7:62: error: 'diff' was not declared in this scope
  for (int i = 1; i + 1 < n; i++) same[i+1] = query(i,i+2) == diff[i] + diff[i+1];
                                                              ^~~~
xylophone.cpp:7:62: note: suggested alternative: 'div'
  for (int i = 1; i + 1 < n; i++) same[i+1] = query(i,i+2) == diff[i] + diff[i+1];
                                                              ^~~~
                                                              div
xylophone.cpp:13:35: error: 'diff' was not declared in this scope
     if (lt) perm[j] = perm[j-1] - diff[j-1];
                                   ^~~~
xylophone.cpp:13:35: note: suggested alternative: 'div'
     if (lt) perm[j] = perm[j-1] - diff[j-1];
                                   ^~~~
                                   div
xylophone.cpp:14:32: error: 'diff' was not declared in this scope
     else perm[j] = perm[j-1] + diff[j-1];
                                ^~~~
xylophone.cpp:14:32: note: suggested alternative: 'div'
     else perm[j] = perm[j-1] + diff[j-1];
                                ^~~~
                                div
xylophone.cpp:16:11: error: 'same' was not declared in this scope
     lt ^= same[j] ^ 1;
           ^~~~
xylophone.cpp:16:11: note: suggested alternative: 'stime'
     lt ^= same[j] ^ 1;
           ^~~~
           stime