Submission #1116380

# Submission time Handle Problem Language Result Execution time Memory
1116380 2024-11-21T14:40:16 Z vjudge1 Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++17
30 / 100
3000 ms 65076 KB
#include <bits/stdc++.h> 
using namespace std;
#define pb push_back 
#define sz size() 
#define in insert 
#define int long long 
#define F first 
#define up upper_bound 
#define S second 
#define lb lower_bound 
#define pair pair<int, int> 
#define all(v) v.begin(),v.end() 
#define FOR1(x, n) for(int j = x; j <= n; j ++) 
#define FOR(x, n) for(int i = x; i <= n; i ++) 
#define FORR(x, n) for(int j = x; j >= n; j --) 
#define nikita ios_base::sync_with_stdio(0), cin.tie(0); 
int n,m,k,t,sum=0,cnt, l,ans = 0, r, x, y, q; 
const int N = 1e6+5;
set<int>g[N]; 
int a[N], b[N];
bool f;
void solve() { 
    nikita
    cin >> n >> m;
    FOR(1, n)cin >> a[i];
    l = 1;
    b[1] = 1;
    FOR(2, n){
        if(a[i] >= a[i-1])b[i] = l;
        else l = i, b[i] = l;
    }
    FOR(1, m){
        cin >> l >> r >> k;
        f=0;
        if(n > 100000 || m > 100000){
            if(b[r] <= l)cout << "1\n";
            else cout << "0\n";
            continue;
        }
        set<int, greater<int>>st;
        st.in(a[r]);
        st.in(0);
        bool hi = 0;
        FORR(r-1, l){
            if(!a[j])hi = 1;
            if(a[j] != 0)x = *st.up(a[j]);
            else continue;
            st.in(a[j]);
            if(!x && !hi)continue;
            if(x + a[j] > k){
                f = 1;
                break;
            }
        }
        if(f)cout << "0\n";
        else cout << "1\n";
    }
}
signed main() { 
    nikita 
    int t=1; 
    FOR(1, t)solve(); 
}
# Verdict Execution time Memory Grader output
1 Correct 10 ms 50512 KB Output is correct
2 Correct 13 ms 50512 KB Output is correct
3 Correct 16 ms 48464 KB Output is correct
4 Correct 16 ms 50512 KB Output is correct
5 Correct 14 ms 48464 KB Output is correct
6 Correct 18 ms 48464 KB Output is correct
7 Correct 22 ms 50512 KB Output is correct
8 Correct 21 ms 48480 KB Output is correct
9 Correct 14 ms 48464 KB Output is correct
10 Correct 11 ms 50512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 50512 KB Output is correct
2 Correct 13 ms 50512 KB Output is correct
3 Correct 16 ms 48464 KB Output is correct
4 Correct 16 ms 50512 KB Output is correct
5 Correct 14 ms 48464 KB Output is correct
6 Correct 18 ms 48464 KB Output is correct
7 Correct 22 ms 50512 KB Output is correct
8 Correct 21 ms 48480 KB Output is correct
9 Correct 14 ms 48464 KB Output is correct
10 Correct 11 ms 50512 KB Output is correct
11 Correct 13 ms 50512 KB Output is correct
12 Correct 17 ms 48720 KB Output is correct
13 Correct 18 ms 50688 KB Output is correct
14 Correct 26 ms 50768 KB Output is correct
15 Correct 18 ms 50512 KB Output is correct
16 Correct 1004 ms 48720 KB Output is correct
17 Correct 591 ms 48720 KB Output is correct
18 Correct 137 ms 50512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 292 ms 64848 KB Output is correct
2 Correct 306 ms 64840 KB Output is correct
3 Correct 302 ms 65076 KB Output is correct
4 Correct 265 ms 64932 KB Output is correct
5 Correct 279 ms 64840 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 3077 ms 54908 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 10 ms 50512 KB Output is correct
2 Correct 13 ms 50512 KB Output is correct
3 Correct 16 ms 48464 KB Output is correct
4 Correct 16 ms 50512 KB Output is correct
5 Correct 14 ms 48464 KB Output is correct
6 Correct 18 ms 48464 KB Output is correct
7 Correct 22 ms 50512 KB Output is correct
8 Correct 21 ms 48480 KB Output is correct
9 Correct 14 ms 48464 KB Output is correct
10 Correct 11 ms 50512 KB Output is correct
11 Correct 13 ms 50512 KB Output is correct
12 Correct 17 ms 48720 KB Output is correct
13 Correct 18 ms 50688 KB Output is correct
14 Correct 26 ms 50768 KB Output is correct
15 Correct 18 ms 50512 KB Output is correct
16 Correct 1004 ms 48720 KB Output is correct
17 Correct 591 ms 48720 KB Output is correct
18 Correct 137 ms 50512 KB Output is correct
19 Incorrect 61 ms 55112 KB Output isn't correct
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 10 ms 50512 KB Output is correct
2 Correct 13 ms 50512 KB Output is correct
3 Correct 16 ms 48464 KB Output is correct
4 Correct 16 ms 50512 KB Output is correct
5 Correct 14 ms 48464 KB Output is correct
6 Correct 18 ms 48464 KB Output is correct
7 Correct 22 ms 50512 KB Output is correct
8 Correct 21 ms 48480 KB Output is correct
9 Correct 14 ms 48464 KB Output is correct
10 Correct 11 ms 50512 KB Output is correct
11 Correct 13 ms 50512 KB Output is correct
12 Correct 17 ms 48720 KB Output is correct
13 Correct 18 ms 50688 KB Output is correct
14 Correct 26 ms 50768 KB Output is correct
15 Correct 18 ms 50512 KB Output is correct
16 Correct 1004 ms 48720 KB Output is correct
17 Correct 591 ms 48720 KB Output is correct
18 Correct 137 ms 50512 KB Output is correct
19 Correct 292 ms 64848 KB Output is correct
20 Correct 306 ms 64840 KB Output is correct
21 Correct 302 ms 65076 KB Output is correct
22 Correct 265 ms 64932 KB Output is correct
23 Correct 279 ms 64840 KB Output is correct
24 Execution timed out 3077 ms 54908 KB Time limit exceeded
25 Halted 0 ms 0 KB -