Submission #1153914

#TimeUsernameProblemLanguageResultExecution timeMemory
1153914justin271828Index (COCI21_index)C++20
0 / 110
37 ms320 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n, q; cin >> n >> q; int arr[n]; for (int i = 0; i < n; i++) cin >> arr[i]; for (int qwerty = 0; qwerty < q; qwerty++) { int l, r; cin >> l >> r; priority_queue<int> pq; for (int i = l; i <= r; i++) pq.push(arr[i-1]); int ans = 1; while (true) { if (pq.empty()) break; if (pq.top() < ans) break; ans++; pq.pop(); } cout << ans << "\n"; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...