Submission #825950

#TimeUsernameProblemLanguageResultExecution timeMemory
825950borisAngelovHedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++17
8 / 100
3070 ms39156 KiB
#include <bits/stdc++.h> using namespace std; const int maxn = 1000005; int n, q; int a[maxn]; void solve(int l, int r, int k) { for (int j = l; j <= r; ++j) { for (int p = j + 1; p <= r; ++p) { if (a[j] > a[p] && a[j] + a[p] > k) { cout << 0 << "\n"; return; } } } cout << 1 << "\n"; } void fastIO() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); } int main() { fastIO(); cin >> n >> q; for (int i = 1; i <= n; ++i) { cin >> a[i]; } for (int i = 1; i <= q; ++i) { int l, r, k; cin >> l >> r >> k; solve(l, r, k); } 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...