Submission #433867

#TimeUsernameProblemLanguageResultExecution timeMemory
433867LouayFarahXylophone (JOI18_xylophone)C++14
Compilation error
0 ms0 KiB
#include "bits/stdc++.h" #include "xylophone.h" using namespace std; #define pb push_back void solve(int n) { vector<int> arr(n+1); /*for(auto elt: arr) cout << elt << ' '; cout << endl;*/ orig.resize(n+1); /*for(int i = 1; i<=n; i++) cin >> orig[i];*/ int l = 1, r = n-1; int maxdif = n-1; while(maxdif==n-1) { maxdif = query(l, r); r--; } r+=2, l++; maxdif = n-1; while(maxdif==n-1) { maxdif = query(l, r); l++; } l-=2; arr[l] = 1; arr[r] = n; //cout << l << ' ' << r << endl; if(r-l>1) { maxdif = query(l, l+1); arr[l+1] = maxdif+1; } for(int i = l+2; i<r; i++) { int dif = query(l, i); if(dif==maxdif) { int dif2 = query(l+1, i); arr[i] = arr[l+1]-dif2; } else { arr[i] = dif + 1; } } if(l>1) { maxdif = query(l-1, l); arr[l-1] = maxdif+1; } for(int i = l-2; i>=1; i--) { int dif = query(i, l); if(dif==maxdif) { int dif2 = query(l-1, i); arr[i] = arr[l-1]-dif2; } else { arr[i] = dif+1; } } if(r<n) { maxdif = query(r, r+1); arr[r+1] = n-maxdif; } for(int i = r+2; r<=n; r++) { int dif = query(r, i); if(dif==maxdif) { int dif2 = query(r+1, i); //cout << i << ' ' << arr[r+1] << ' ' << dif2 << endl; arr[i] = arr[r+1] + dif2; } else { arr[i] = n-dif; } } /*for(auto elt: arr) cout << elt << ' '; cout << endl;*/ for(int i = 1; i<=n; i++) { answer(i, arr[i]); } }

Compilation message (stderr)

xylophone.cpp: In function 'void solve(int)':
xylophone.cpp:13:5: error: 'orig' was not declared in this scope
   13 |     orig.resize(n+1);
      |     ^~~~