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;
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |