답안 #493246

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
493246 2021-12-10T13:39:49 Z PiejanVDC Index (COCI21_index) C++17
20 / 110
2500 ms 1620 KB
#include <bits/stdc++.h>
using namespace std;

signed main() {
    int n,_q; cin>>n>>_q;
    vector<int>v(n);
    for(auto &z : v)
        cin>>z;
    while(_q--) {
        int l,r; cin>>l>>r;
        l--,r--;
        vector<int>nw;
        for(int ll = l ; ll <= r ; ll++) {
            nw.push_back(v[ll]);
        }
        sort(nw.rbegin(),nw.rend());
        int len = r-l+1;
        int ans=0;
        for(int i = len-1 ; i >= 0 ; i--) {
            int curr = min(i+1,nw[i]);
            ans=max(ans,curr);
        }
        cout << ans << "\n";
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 43 ms 204 KB Output is correct
2 Correct 44 ms 204 KB Output is correct
3 Correct 44 ms 204 KB Output is correct
4 Correct 43 ms 204 KB Output is correct
5 Correct 48 ms 204 KB Output is correct
6 Correct 43 ms 204 KB Output is correct
7 Correct 42 ms 204 KB Output is correct
8 Correct 43 ms 204 KB Output is correct
9 Correct 46 ms 204 KB Output is correct
10 Correct 42 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 43 ms 204 KB Output is correct
2 Correct 44 ms 204 KB Output is correct
3 Correct 44 ms 204 KB Output is correct
4 Correct 43 ms 204 KB Output is correct
5 Correct 48 ms 204 KB Output is correct
6 Correct 43 ms 204 KB Output is correct
7 Correct 42 ms 204 KB Output is correct
8 Correct 43 ms 204 KB Output is correct
9 Correct 46 ms 204 KB Output is correct
10 Correct 42 ms 204 KB Output is correct
11 Execution timed out 2574 ms 1620 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 43 ms 204 KB Output is correct
2 Correct 44 ms 204 KB Output is correct
3 Correct 44 ms 204 KB Output is correct
4 Correct 43 ms 204 KB Output is correct
5 Correct 48 ms 204 KB Output is correct
6 Correct 43 ms 204 KB Output is correct
7 Correct 42 ms 204 KB Output is correct
8 Correct 43 ms 204 KB Output is correct
9 Correct 46 ms 204 KB Output is correct
10 Correct 42 ms 204 KB Output is correct
11 Execution timed out 2574 ms 1620 KB Time limit exceeded
12 Halted 0 ms 0 KB -