제출 #330716

#제출 시각아이디문제언어결과실행 시간메모리
330716vitkishloh228Hedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++14
컴파일 에러
0 ms0 KiB
#include<iostream> #include<vector> #include<algorithm> using namespace std; int main() { int n, q; cin >> n >> q; vector<int> a(n); for (int& i : a) cin >> i; while (q--) { int l, r, c; cin >> l >> r >> c; --l, --r; int ans = 0; for (int i = l; i <= r; ++i) { for (int j = i + 1; j <= r; ++j) { if (a[i] > a[j]) { ans = max(ans, a[i] + a[j]); } } } if (ans <= k) { cout << 1 << endl; } else cout << 0 << endl; } }

컴파일 시 표준 에러 (stderr) 메시지

sortbooks.cpp: In function 'int main()':
sortbooks.cpp:22:20: error: 'k' was not declared in this scope
   22 |         if (ans <= k) {
      |                    ^