Submission #502330

#TimeUsernameProblemLanguageResultExecution timeMemory
502330vrohakXylophone (JOI18_xylophone)C++14
Compilation error
0 ms0 KiB
#include "xylophone.h" void solve(int n) { // ako je x pozitivan //ako je x pozitivan //ako je x pozitivan //ako je x // pozitivan //ako je x pozitivan //ako je x pozitivan //ako je x pozitivan // //ako je x pozitivan int zj1[n+1], zj2[n+1]; int d[n+1], t[n+1], og1, og2, og3; bool sss=true; for(int i=1;i<n;i++){ d[i] = query(i, i+1); if(i!=1) t[i] = query(i-1, i+1); } odg2=d[0]; zj1[1] = 0; zj1[2] = og2; for (int i = 3; i <= n; i++) { og1 = d[i-2]; og2 = d[i-1]; og3 = t[i-1]; if(og1+og2 != og3){ sss = !sss; } zj1[i] = zj1[i-1] + og2 * (sss * 2 - 1); } int mn = 0, mx=0, idx1, idxn; for (int i = 1; i <= n; i++) { if(rj1[i] < mn){ mn = zj1[i]; idx1 = i; } if(rj1[i] > mx){ mx = zj1[i]; idxn = i; } } mn = -mn + 1; for (int i = 1; i <= n; i++) { zj2[i] = mx-zj1[i]+1; zj1[i] = zj1[i] + mn; } if (idx1 < idxn) { for (int i = 1; i <= n; i++) { answer(i, rj1[i]); } } else { for (int i = 1; i <= n; i++) { answer(i, rj2[i]); } } return; }

Compilation message (stderr)

xylophone.cpp: In function 'void solve(int)':
xylophone.cpp:17:4: error: 'odg2' was not declared in this scope; did you mean 'og2'?
   17 |    odg2=d[0];
      |    ^~~~
      |    og2
xylophone.cpp:33:10: error: 'rj1' was not declared in this scope; did you mean 'zj1'?
   33 |       if(rj1[i] < mn){
      |          ^~~
      |          zj1
xylophone.cpp:37:10: error: 'rj1' was not declared in this scope; did you mean 'zj1'?
   37 |       if(rj1[i] > mx){
      |          ^~~
      |          zj1
xylophone.cpp:50:20: error: 'rj1' was not declared in this scope; did you mean 'zj1'?
   50 |          answer(i, rj1[i]);
      |                    ^~~
      |                    zj1
xylophone.cpp:54:20: error: 'rj2' was not declared in this scope; did you mean 'zj2'?
   54 |          answer(i, rj2[i]);
      |                    ^~~
      |                    zj2