# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1235997 | jungle15 | Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) | C++17 | 3094 ms | 6220 KiB |
#include <bits/stdc++.h>
using namespace std;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
#define Jungle "IZhO19_sortbooks"
#define MASK(i) (1 << (i))
#define getbit(x, i) (((x) >> (i)) & 1)
#define cntbit __builtin_popcount
#define MULTEST \
int nq; \
cin >> nq; \
while(nq--)
template <typename t> void chkmin(t &a, t b) {
if (a > b) a = b;
}
template <typename t> void chkmax(t &a, t b) {
if (a < b) a = b;
}
int n, m, a[1000002];
void solve(void) {
cin >> n >> m;
for(int i = 1; i <= n; i++) cin >> a[i];
for(int i = 1; i <= m; i++){
bool check = 1;
int l, r, k, ma = -1;
cin >> l >> r >> k;
for(int j = l; j <= r; j++) {
chkmax(ma, a[j]);
if(ma > a[j] && ma + a[j] > k){
check = 0;
break;
}
}
cout << check << '\n';
}
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(nullptr); cout.tie(nullptr);
if (fopen(Jungle".inp", "r")) {
freopen(Jungle".inp", "r", stdin);
freopen(Jungle".out", "w", stdout);
}
// MULTEST
solve();
// cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |