Submission #499778

# Submission time Handle Problem Language Result Execution time Memory
499778 2021-12-29T12:28:33 Z yahyobekabdunazarov Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++17
0 / 100
420 ms 14720 KB
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    int a[n], dp[n], dp2[n];
    for (int i = 0; i < n; i++){
        cin >> a[i];
    }
    dp[0]=0;
    for (int i = 1; i < n; i++){
        dp[i]=dp[i-1];
        if(a[i-1]>a[i]){
            dp[i]+=a[i-1];
        }
    }
    for(int i = 0; i<n; i++){
        dp2[i]=dp[i]+a[i];
    }
    for(int i = 0; i<m; i++){
        int l, r, k;
        cin >> l >> r >> k;
        dp2[r-1]-dp2[l-1]<=k?cout << "1\n":cout << "0\n";
    }
    return 0;
}
# 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 Incorrect 1 ms 204 KB Output isn't correct
4 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 Incorrect 1 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 420 ms 14720 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 32 ms 2024 KB Output isn't correct
2 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 Incorrect 1 ms 204 KB Output isn't correct
4 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 Incorrect 1 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -