update
This commit is contained in:
parent
a0a23f7571
commit
d3292ba39e
1
.gitignore
vendored
1
.gitignore
vendored
@ -49,3 +49,4 @@ day4/U76034/chat
|
||||
day4/U287193/chat
|
||||
day4/U461920/fixed
|
||||
day5/hard/hard
|
||||
day5/perfect/perfect
|
||||
|
@ -42,6 +42,10 @@ int main(){
|
||||
#### 通过异色中转
|
||||
#### 环
|
||||
|
||||
## Day5
|
||||
### 需要学习的点
|
||||
>区间最值
|
||||
|
||||
# 排序
|
||||
## 稳定性
|
||||
>隔着老远swap一般不稳定
|
||||
|
30
day5/perfect/perfect.cpp
Normal file
30
day5/perfect/perfect.cpp
Normal file
@ -0,0 +1,30 @@
|
||||
//暴力10/100points
|
||||
|
||||
#include<bits/stdc++.h>
|
||||
using namespace std;
|
||||
|
||||
const int MAX_N=3e5+5;
|
||||
int n;
|
||||
int a[MAX_N];
|
||||
int ans=INT_MIN;
|
||||
|
||||
int main(){
|
||||
cin.sync_with_stdio(false);
|
||||
cin.tie(0);
|
||||
cin>>n;
|
||||
for(int i=1;i<=n;i++){
|
||||
cin>>a[i];
|
||||
}
|
||||
for(int l=1;l<=n;l++){
|
||||
for(int r=l;r<=n;r++){
|
||||
int max_num=INT_MIN;
|
||||
int min_num=INT_MAX;
|
||||
for(int i=l;i<=r;i++){
|
||||
max_num=max(max_num,a[i]);
|
||||
min_num=min(min_num,a[i]);
|
||||
}
|
||||
ans=max(ans,max_num^min_num);
|
||||
}
|
||||
}
|
||||
cout<<ans<<endl;
|
||||
}
|
Loading…
Reference in New Issue
Block a user