Submission #330716

#TimeUsernameProblemLanguageResultExecution timeMemory
330716vitkishloh228Hedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++14
Compilation error
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; } }

Compilation message (stderr)

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