제출 #501897

#제출 시각아이디문제언어결과실행 시간메모리
501897nightyHedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++14
17 / 100
3073 ms6452 KiB
#include <bits/stdc++.h> using namespace std; bool canSort(vector<int>& a, int l, int r, int k) { int maxVal = 0; for (int i = l; i <= r; ++i) { if (maxVal > a[i] && maxVal + a[i] > k) { return false; } maxVal = max(maxVal, a[i]); } return true; } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n, m; cin >> n >> m; vector<int> a(n); for (auto& i : a) { cin >> i; } while (m--) { int l, r, k; cin >> l >> r >> k; --l, --r; cout << canSort(a, l, r, k) << '\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...