Submission #490512

# Submission time Handle Problem Language Result Execution time Memory
490512 2021-11-27T17:06:24 Z fuad27 Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++17
0 / 100
3000 ms 14024 KB
#include<bits/stdc++.h>
using namespace std;
const long long N = 1e6 + 10;
int main () {
    int n, m;
    cin >> n >> m;
    long long arr[n];
    for(int i = 0;i<n;i++)cin>>arr[i];
    int prefix[n+1] = {0};
    long long MIN = arr[0];
    for(int i = 2;i<=n;i++){
        MIN = min(MIN, arr[i-1]);
        prefix[i] = (prefix[i-1]+(arr[i-1] >= arr[i-2]));
    }
    while(m--) {
        int l, r, m;
        cin >> l >> r >> m;
        long long MAX = arr[l-1],ans = 0; 
        if(m <= MIN) {
            cout << (prefix[r]-prefix[l-1] == r-l) << endl;
        }
        else {
        for(int i = l;i<r;i++) {
            MAX = max(arr[i],MAX);
            if(arr[i] < MAX)
            ans = max(ans, MAX+arr[i]);
        }
        cout << (ans <= m) << endl;}
    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 2 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 2 ms 204 KB Output is correct
9 Correct 2 ms 204 KB Output is correct
10 Incorrect 2 ms 204 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 2 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 2 ms 204 KB Output is correct
9 Correct 2 ms 204 KB Output is correct
10 Incorrect 2 ms 204 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 2504 ms 14024 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2697 ms 1916 KB Output is correct
2 Execution timed out 3095 ms 1464 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 2 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 2 ms 204 KB Output is correct
9 Correct 2 ms 204 KB Output is correct
10 Incorrect 2 ms 204 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 2 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 2 ms 204 KB Output is correct
9 Correct 2 ms 204 KB Output is correct
10 Incorrect 2 ms 204 KB Output isn't correct