Submission #979810

# Submission time Handle Problem Language Result Execution time Memory
979810 2024-05-11T11:54:48 Z asdasdqwer Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++14
0 / 100
3000 ms 18664 KB
#include <bits/stdc++.h>
using namespace std;

signed main() {
    int n,m;cin>>n>>m;
    vector<int> a(n);
    for (auto &x:a)cin>>x;

    for (int i=0;i<m;i++) {
        vector<int> tmp;
        int l, r,k;cin>>l>>r>>k;l--;r--;
        for (int j=l;j<=r;j++) {
            tmp.push_back(a[j]);
        }

        vector<int> tmp2 = tmp;
        sort(tmp.begin(), tmp.end());
        int ans = 0;
        for (int j=0;j<(int)tmp.size();j++) {
            if (tmp[j] != tmp2[j]) {
                ans = max(ans, max(tmp[j], tmp2[j]));
            }
        }

        if (ans != 0) {
            ans += tmp[0];
        }

        if (k >= ans) cout<<"1\n";
        else cout<<"0\n";
    }    
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 604 KB Output is correct
3 Incorrect 2 ms 460 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 604 KB Output is correct
3 Incorrect 2 ms 460 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3009 ms 18664 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3042 ms 2176 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 604 KB Output is correct
3 Incorrect 2 ms 460 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 604 KB Output is correct
3 Incorrect 2 ms 460 KB Output isn't correct
4 Halted 0 ms 0 KB -