Submission #883292

#TimeUsernameProblemLanguageResultExecution timeMemory
883292AI_2512Hedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++17
17 / 100
3048 ms67112 KiB
#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++){ cin >>days[i][0] >> days[i][1] >> days[i][2]; vector<int> vec(books.begin()+days[i][0]-1, books.begin()+days[i][1]); bool broken = false; for (int k = 0;k < vec.size()-1;k++){ if (vec[k] > vec[k+1]){ if (vec[k]+vec[k+1] <= days[i][2]){ int t = vec[k]; vec[k] = vec[k+1]; vec[k+1] = t; }else{ broken = true; break; } } } if (broken){ cout << 0 << "\n"; }else{ cout << 1 << "\n"; } } return 0; }

Compilation message (stderr)

sortbooks.cpp: In function 'int main()':
sortbooks.cpp:17:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |         for (int k = 0;k < vec.size()-1;k++){
      |                        ~~^~~~~~~~~~~~~~
#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...