Submission #342837

#TimeUsernameProblemLanguageResultExecution timeMemory
342837dimashiiHedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++17
17 / 100
115 ms4204 KiB
#include <bits/stdc++.h> #define fastio ios :: sync_with_stdio(0), cin.tie(0), cout.tie(0); #define ll long long using namespace std; const int mxN = 1e6 + 45, mod = 1e9 + 7; const ll inf = 2e18 + 43; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); int n, m, w[mxN]; int main() { fastio; cin >> n >> m; for (int i = 1; i <= n; ++i) cin >> w[i]; if (m <= 5000) { while (m--) { int l, r, k; cin >> l >> r >> k; int mx = w[l]; bool bad = 0; for (int i = l + 1; i <= r; ++i) { if (mx > w[i] && mx + w[i] > k) { bad = 1; break; } mx = max(mx, w[i]); } cout << !bad << '\n'; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...