# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
988973 | 2024-05-27T07:46:30 Z | MercubytheFirst | Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) | C++17 | 3000 ms | 22168 KB |
#include <bits/stdc++.h> using ll = long long; #define pb push_back using namespace std; #define CDIV(a, b) ((((a) - (1)) / (b)) + 1) void solve() { int n, Q; cin >> n >> Q; vector<int> v(n + 1); for(int i = 1; i <= n; ++i) { cin >> v[i]; } while(Q--) { int l, r, k; cin >> l >> r >> k; set<int> s; int mx = -1; for(int i = l; i <= r; ++i) { if(!s.empty() and *s.rbegin() > v[i]) { mx = max(mx, v[i] + *s.rbegin()); } s.insert(v[i]); } if(mx > k) { cout << 0 << endl; } else { cout << 1 << endl; } } } signed main() { #ifndef ONLINE_JUDGE freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout); #endif ios_base::sync_with_stdio(false); cin.tie(NULL); // signed t = 0; cin >> t; while(t --> 0) solve(); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3064 ms | 21244 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3064 ms | 21244 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3013 ms | 22168 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3016 ms | 22000 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3064 ms | 21244 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3064 ms | 21244 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |