Submission #1153917

#TimeUsernameProblemLanguageResultExecution timeMemory
1153917justin271828Index (COCI21_index)C++20
20 / 110
2592 ms1068 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-1 << "\n"; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...