Submission #1133471

#TimeUsernameProblemLanguageResultExecution timeMemory
1133471lopkusIndex (COCI21_index)C++20
20 / 110
2590 ms1724 KiB
#include <bits/stdc++.h>. #define int long long using namespace std; signed main(){ ios::sync_with_stdio(false); cin.tie(0); int n, q; cin >> n >> q; vector<int> a(n + 1); for(int i = 1; i <= n; i++) { cin >> a[i]; } while(q--) { int l, r; cin >> l >> r; vector<int> V; for(int i = l; i <= r; i++) { V.push_back(a[i]); } sort(V.rbegin(), V.rend()); int ans = 0; for(int i = 0; i < V.size(); i++) { if(V[i] > i) { ans = i + 1; } } cout << ans << "\n"; } }

Compilation message (stderr)

index.cpp:1:25: warning: extra tokens at end of #include directive
    1 | #include <bits/stdc++.h>.
      |                         ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...