Submission #931751

#TimeUsernameProblemLanguageResultExecution timeMemory
931751AiperiiiHedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++14
8 / 100
3049 ms32940 KiB
#include <bits/stdc++.h> #define int long long #define ff first #define ss second #define all(x) x.begin(),x.end() #define pb push_back using namespace std; signed main(){ ios_base::sync_with_stdio(); cin.tie(0);cout.tie(0); int n,q; cin>>n>>q; vector <int> a(n+1); for(int i=1;i<=n;i++)cin>>a[i]; while(q--){ int l,r,x; cin>>l>>r>>x; vector <int> v; for(int i=l;i<=r;i++)v.pb(a[i]); bool ok=1; for(int i=0;i<v.size();i++){ for(int j=0;j<v.size()-i-1;j++){ if(v[j]>v[j+1]){ swap(v[j],v[j+1]); if(x<v[j]+v[j+1]){ ok=0;break; } } } } cout<<ok<<"\n"; } } /* 5 2 3 5 1 8 2 1 3 6 2 5 3 */

Compilation message (stderr)

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