답안 #991577

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
991577 2024-06-02T13:36:30 Z Mardonbekhazratov Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++17
30 / 100
3000 ms 10196 KB
#include<bits/stdc++.h>
using namespace std;

void solve(){
    int n,m;
    cin>>n>>m;
    vector<int>a(n),dp(n);
    dp[0]=0;
    int mn=1e9;
    for(int i=0;i<n;i++){
        cin>>a[i];
        mn=min(a[i],mn);
        if(i>0){
            dp[i]=dp[i-1]+(a[i]<a[i-1]);
        }
    }
    while(m--){
        int l,r,k;
        cin>>l>>r>>k;
        if(k<mn){
            cout<<(dp[r-1]-dp[l-1]==0)<<'\n';
            continue;
        }
        --l;
        int mx=0;
        bool ans=true;
        for(int i=l;i<r;i++){
            mx=max(a[i],mx);
            if(mx>a[i] && mx+a[i]>k) ans=false;
        }
        cout<<ans<<'\n';
    }
}

signed main(){
    int t=1;
    // cin>>t;
    while(t--){
        solve();
        cout<<'\n';
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 6 ms 348 KB Output is correct
12 Correct 8 ms 472 KB Output is correct
13 Correct 10 ms 348 KB Output is correct
14 Correct 15 ms 476 KB Output is correct
15 Correct 17 ms 348 KB Output is correct
16 Correct 17 ms 348 KB Output is correct
17 Correct 14 ms 348 KB Output is correct
18 Correct 17 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1956 ms 10040 KB Output is correct
2 Correct 1929 ms 10068 KB Output is correct
3 Correct 1993 ms 10068 KB Output is correct
4 Correct 1939 ms 10196 KB Output is correct
5 Correct 1876 ms 10040 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1777 ms 1228 KB Output is correct
2 Execution timed out 3066 ms 1364 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 6 ms 348 KB Output is correct
12 Correct 8 ms 472 KB Output is correct
13 Correct 10 ms 348 KB Output is correct
14 Correct 15 ms 476 KB Output is correct
15 Correct 17 ms 348 KB Output is correct
16 Correct 17 ms 348 KB Output is correct
17 Correct 14 ms 348 KB Output is correct
18 Correct 17 ms 348 KB Output is correct
19 Execution timed out 3063 ms 2132 KB Time limit exceeded
20 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 6 ms 348 KB Output is correct
12 Correct 8 ms 472 KB Output is correct
13 Correct 10 ms 348 KB Output is correct
14 Correct 15 ms 476 KB Output is correct
15 Correct 17 ms 348 KB Output is correct
16 Correct 17 ms 348 KB Output is correct
17 Correct 14 ms 348 KB Output is correct
18 Correct 17 ms 348 KB Output is correct
19 Correct 1956 ms 10040 KB Output is correct
20 Correct 1929 ms 10068 KB Output is correct
21 Correct 1993 ms 10068 KB Output is correct
22 Correct 1939 ms 10196 KB Output is correct
23 Correct 1876 ms 10040 KB Output is correct
24 Correct 1777 ms 1228 KB Output is correct
25 Execution timed out 3066 ms 1364 KB Time limit exceeded
26 Halted 0 ms 0 KB -