Submission #677697

#TimeUsernameProblemLanguageResultExecution timeMemory
677697AlcabelHedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++17
17 / 100
3053 ms39076 KiB
#include <bits/stdc++.h> using namespace std; void solve() { int n, m; cin >> n >> m; vector<int> w(n); for (int i = 0; i < n; ++i) { cin >> w[i]; } for (int i = 0; i < m; ++i) { int l, r, k; cin >> l >> r >> k; --l, --r; bool able = true; for (int j = l + 1, mx = w[l]; j <= r; ++j) { if (mx > w[j] && mx + w[j] > k) { able = false; break; } mx = max(mx, w[j]); } cout << able << '\n'; } } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int T = 1; // cin >> T; while (T--) { solve(); } 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...