Submission #979799

# Submission time Handle Problem Language Result Execution time Memory
979799 2024-05-11T11:34:52 Z asdasdqwer Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++14
0 / 100
3000 ms 11800 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 (k >= ans) cout<<"1\n";
        else cout<<"0\n";
    }    
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Incorrect 2 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Incorrect 2 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3040 ms 11800 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3041 ms 1924 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Incorrect 2 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Incorrect 2 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -