Submission #1010710

#TimeUsernameProblemLanguageResultExecution timeMemory
1010710pccSushi (JOI16_sushi)C++17
5 / 100
12053 ms6492 KiB
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,popcnt,sse4") const int mxn = 4e5+10; int arr[mxn]; int N,Q; int main(){ cin>>N>>Q; for(int i = 1;i<=N;i++)cin>>arr[i]; while(Q--){ int l,r,a; cin>>l>>r>>a; if(l>r){ for(int i = l;i<=N;i++)if(arr[i]>a)swap(a,arr[i]); for(int i = 1;i<=r;i++)if(arr[i]>a)swap(a,arr[i]); } else{ for(int i = l;i<=r;i++)if(arr[i]>a)swap(arr[i],a); } cout<<a<<'\n'; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...