Submission #651212

# Submission time Handle Problem Language Result Execution time Memory
651212 2022-10-18T02:56:15 Z owoovo Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++14
30 / 100
3000 ms 16896 KB
#include<bits/stdc++.h>
using namespace std;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    int n,m;
    cin>>n>>m;
    int w[1000010],sortfrom[1000010],fm=0;
    cin>>w[0];
    sortfrom[0]=0;
    for(int i=1;i<n;i++){
        cin>>w[i];
        if(w[i]<w[i-1]){
            fm=i;
        }
      sortfrom[i]=fm;
    }
    for(int i=0;i<m;i++){
        int l,r,k,isok=1;
        cin>>l>>r>>k;
        r--;
        l--;
        if(sortfrom[r]<=l){
          
            cout<<"1\n";
            continue;
        }
        set<int> s;
        for(int j=r;j>=l;j--){
            if(!s.empty()){
                set<int>::iterator q=s.lower_bound(w[j]);
                if(q!=s.begin()){
                    q--;
                    if(w[j]+*q>k){
                        cout<<"0\n";
                        isok=0;
                        break;
                    }
                }
            }
            s.insert(w[j]);
        }
        if(isok){
            cout<<"1\n";
        }
      }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 8020 KB Output is correct
2 Correct 4 ms 8020 KB Output is correct
3 Correct 4 ms 8020 KB Output is correct
4 Correct 4 ms 8148 KB Output is correct
5 Correct 4 ms 8148 KB Output is correct
6 Correct 4 ms 8148 KB Output is correct
7 Correct 5 ms 8148 KB Output is correct
8 Correct 13 ms 8148 KB Output is correct
9 Correct 8 ms 8148 KB Output is correct
10 Correct 6 ms 8020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 8020 KB Output is correct
2 Correct 4 ms 8020 KB Output is correct
3 Correct 4 ms 8020 KB Output is correct
4 Correct 4 ms 8148 KB Output is correct
5 Correct 4 ms 8148 KB Output is correct
6 Correct 4 ms 8148 KB Output is correct
7 Correct 5 ms 8148 KB Output is correct
8 Correct 13 ms 8148 KB Output is correct
9 Correct 8 ms 8148 KB Output is correct
10 Correct 6 ms 8020 KB Output is correct
11 Correct 9 ms 8148 KB Output is correct
12 Correct 10 ms 8248 KB Output is correct
13 Correct 11 ms 8148 KB Output is correct
14 Correct 16 ms 8284 KB Output is correct
15 Correct 15 ms 8232 KB Output is correct
16 Correct 1261 ms 8364 KB Output is correct
17 Correct 747 ms 8316 KB Output is correct
18 Correct 59 ms 8020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 514 ms 10300 KB Output is correct
2 Correct 509 ms 10060 KB Output is correct
3 Correct 502 ms 10168 KB Output is correct
4 Correct 497 ms 10248 KB Output is correct
5 Correct 406 ms 10060 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 3078 ms 8176 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 8020 KB Output is correct
2 Correct 4 ms 8020 KB Output is correct
3 Correct 4 ms 8020 KB Output is correct
4 Correct 4 ms 8148 KB Output is correct
5 Correct 4 ms 8148 KB Output is correct
6 Correct 4 ms 8148 KB Output is correct
7 Correct 5 ms 8148 KB Output is correct
8 Correct 13 ms 8148 KB Output is correct
9 Correct 8 ms 8148 KB Output is correct
10 Correct 6 ms 8020 KB Output is correct
11 Correct 9 ms 8148 KB Output is correct
12 Correct 10 ms 8248 KB Output is correct
13 Correct 11 ms 8148 KB Output is correct
14 Correct 16 ms 8284 KB Output is correct
15 Correct 15 ms 8232 KB Output is correct
16 Correct 1261 ms 8364 KB Output is correct
17 Correct 747 ms 8316 KB Output is correct
18 Correct 59 ms 8020 KB Output is correct
19 Execution timed out 3072 ms 16896 KB Time limit exceeded
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 8020 KB Output is correct
2 Correct 4 ms 8020 KB Output is correct
3 Correct 4 ms 8020 KB Output is correct
4 Correct 4 ms 8148 KB Output is correct
5 Correct 4 ms 8148 KB Output is correct
6 Correct 4 ms 8148 KB Output is correct
7 Correct 5 ms 8148 KB Output is correct
8 Correct 13 ms 8148 KB Output is correct
9 Correct 8 ms 8148 KB Output is correct
10 Correct 6 ms 8020 KB Output is correct
11 Correct 9 ms 8148 KB Output is correct
12 Correct 10 ms 8248 KB Output is correct
13 Correct 11 ms 8148 KB Output is correct
14 Correct 16 ms 8284 KB Output is correct
15 Correct 15 ms 8232 KB Output is correct
16 Correct 1261 ms 8364 KB Output is correct
17 Correct 747 ms 8316 KB Output is correct
18 Correct 59 ms 8020 KB Output is correct
19 Correct 514 ms 10300 KB Output is correct
20 Correct 509 ms 10060 KB Output is correct
21 Correct 502 ms 10168 KB Output is correct
22 Correct 497 ms 10248 KB Output is correct
23 Correct 406 ms 10060 KB Output is correct
24 Execution timed out 3078 ms 8176 KB Time limit exceeded
25 Halted 0 ms 0 KB -