Submission #521275

#TimeUsernameProblemLanguageResultExecution timeMemory
521275dostigatorHedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++17
0 / 100
3074 ms14336 KiB
#pragma GCC optimize("O3") #pragma GCC target("popcnt") #include <bits/stdc++.h> using namespace std; #define IShowSpeed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define popcnt __builtin_popcount #define all(a) a.begin(),a.end() #define pii pair<ll,ll> #define mii map<ll,ll> #define pll pair<ll,ll> #define mll map<ll,ll> #define pb push_back #define vt vector #define endl '\n' #define X first #define Y second typedef long double ld; typedef long long ll; const ll dx[4]={1,-1,0,0},dy[4]={0,0,1,-1},N=2e6; const ll mod=1e9+7,inf=1e18; int n,m; int a[N]; void solve(){ cin>>n>>m; for(int i=1; i<=n; ++i) cin>>a[i]; for(int i=1; i<=m; ++i){ int l,r,k; cin>>l>>r>>k; vt<int>t; while(l<=r){ t.pb(a[l]); ++l; } int ans=0; for(int x=0; x<t.size(); ++x) for(int y=0; y<t.size()-1; ++y) if(t[y]>t[y+1]) {swap(t[y],t[y+1]); ans=max(ans,t[y+1]-t[y]);} cout<<(ans>k?0:1)<<endl; } } int main() { IShowSpeed; ll tt=1; //cin>>tt; while(tt--) solve(); }

Compilation message (stderr)

sortbooks.cpp: In function 'void solve()':
sortbooks.cpp:35:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |         for(int x=0; x<t.size(); ++x) for(int y=0; y<t.size()-1; ++y) if(t[y]>t[y+1]) {swap(t[y],t[y+1]); ans=max(ans,t[y+1]-t[y]);}
      |                      ~^~~~~~~~~
sortbooks.cpp:35:53: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |         for(int x=0; x<t.size(); ++x) for(int y=0; y<t.size()-1; ++y) if(t[y]>t[y+1]) {swap(t[y],t[y+1]); ans=max(ans,t[y+1]-t[y]);}
      |                                                    ~^~~~~~~~~~~
#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...