# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
883319 | AI_2512 | Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) | C++17 | 3050 ms | 66872 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n,m;
cin >> n >> m;
vector<int> books(n);
vector<vector<int>> days(m,vector<int>(3));
for (int i = 0; i <n; i++){
cin >> books[i];
}
for (int i = 0; i<m; i++){
int l,r,ki;
cin >> l >> r >> ki;
vector<int> vec(books.begin()+l-1, books.begin()+r);
bool broken = false;
for (int k = 0;k < vec.size()-1;k++){
if (vec[k] > vec[k+1]){
if (vec[k]+vec[k+1] <= ki){
swap(vec[k], vec[k+1]);
}else{
broken = true;
break;
}
}
}
if (broken){
cout << 0 << "\n";
}else{
cout << 1 << "\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... |