제출 #433880

#제출 시각아이디문제언어결과실행 시간메모리
433880LouayFarahXylophone (JOI18_xylophone)C++14
컴파일 에러
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; i<=n; i++) { int dif = query(r, i); if(dif==maxdif) { int dif2 = query(r+1, i); arr[i] = arr[r+1] + dif2; } else { arr[i] = n-dif; } } for(int i = 1; i<=n; i++) { answer(i, arr[i]); } }

컴파일 시 표준 에러 (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);
      |     ^~~~