Submission #598925

# Submission time Handle Problem Language Result Execution time Memory
598925 2022-07-19T07:52:26 Z Jomnoi Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++17
0 / 100
3000 ms 40756 KB
#include <bits/stdc++.h>
using namespace std;

const int MAX_N = 1e6 + 5;

int w[MAX_N];

int main() {
    cin.tie(nullptr)->sync_with_stdio(false);

    int N, M;
    cin >> N >> M;

    for(int i = 1; i <= N; i++) {
        cin >> w[i];
    }

    while(M--) {
        int l, r, k;
        cin >> l >> r >> k;

        multiset <int> s;
        for(int i = l; i <= r; i++) {
            s.insert(w[i]);
        }

        int ma = 0;
        for(int i = l; i < r; i++) {
            s.erase(s.lower_bound(w[i]));
            ma = max(ma, w[i] + *prev(s.lower_bound(w[i])));
        }

        cout << (ma <= k) << '\n';
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 3 ms 340 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 3 ms 340 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3054 ms 40756 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3061 ms 5556 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 3 ms 340 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 3 ms 340 KB Output isn't correct
4 Halted 0 ms 0 KB -