Submission #931799

# Submission time Handle Problem Language Result Execution time Memory
931799 2024-02-22T11:01:11 Z Aiperiii Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++14
17 / 100
3000 ms 24168 KB
#include <bits/stdc++.h>
#define int long long
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define pb push_back
using namespace std;
signed main(){
    ios_base::sync_with_stdio();
    cin.tie(0);cout.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,x;
        cin>>l>>r>>x;
        vector <int> v;
        for(int i=l;i<=r;i++)v.pb(a[i]);
        bool ok=1;
        set <int> st;
        for(int i=v.size()-1;i>=0;i--){
            auto it=st.lower_bound(v[i]);
            if(it!=st.begin()){
                it--;
                if(x<*it+v[i]){
                    ok=0;break;
                }
            }
            st.insert(v[i]);
        }
        cout<<ok<<"\n";
    }
}
/*
5 2
3 5 1 8 2
1 3 6
2 5 3
 
7 1
2 8 9 8 10 3 1
1 7 12
 2 8 9 8 10 1 3
 2 8 9 8 1 3 10
 2 8 9 1 3 8 10
 2 8 1 3 8 9 10
 2 1 3 8 8 9 10
 1 2 3 8 8 9 10
 */


         

# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 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 2 ms 348 KB Output is correct
8 Correct 9 ms 472 KB Output is correct
9 Correct 5 ms 344 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 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 2 ms 348 KB Output is correct
8 Correct 9 ms 472 KB Output is correct
9 Correct 5 ms 344 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 8 ms 348 KB Output is correct
12 Correct 18 ms 600 KB Output is correct
13 Correct 17 ms 592 KB Output is correct
14 Correct 32 ms 596 KB Output is correct
15 Correct 24 ms 856 KB Output is correct
16 Correct 1218 ms 1000 KB Output is correct
17 Correct 739 ms 1012 KB Output is correct
18 Correct 72 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 3075 ms 24168 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3024 ms 3008 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 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 2 ms 348 KB Output is correct
8 Correct 9 ms 472 KB Output is correct
9 Correct 5 ms 344 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 8 ms 348 KB Output is correct
12 Correct 18 ms 600 KB Output is correct
13 Correct 17 ms 592 KB Output is correct
14 Correct 32 ms 596 KB Output is correct
15 Correct 24 ms 856 KB Output is correct
16 Correct 1218 ms 1000 KB Output is correct
17 Correct 739 ms 1012 KB Output is correct
18 Correct 72 ms 600 KB Output is correct
19 Execution timed out 3034 ms 14852 KB Time limit exceeded
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 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 2 ms 348 KB Output is correct
8 Correct 9 ms 472 KB Output is correct
9 Correct 5 ms 344 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 8 ms 348 KB Output is correct
12 Correct 18 ms 600 KB Output is correct
13 Correct 17 ms 592 KB Output is correct
14 Correct 32 ms 596 KB Output is correct
15 Correct 24 ms 856 KB Output is correct
16 Correct 1218 ms 1000 KB Output is correct
17 Correct 739 ms 1012 KB Output is correct
18 Correct 72 ms 600 KB Output is correct
19 Execution timed out 3075 ms 24168 KB Time limit exceeded
20 Halted 0 ms 0 KB -