看懂了吧 好的,现在我们再随便扔进去一点垃圾代码装装样子
#include<bits/stdc++.h>
#define int long long
using namespace std;
inline int read() {int x=0,f=1; char ch=getchar();while(ch<'0'||ch>'9') { if(ch=='-') f=-1; ch=getchar();}while(ch>='0' && ch<='9') x=x*10+ch-'0',ch=getchar();return x*f;}
int a[1000006],n,b[1000006],zero[1000006],cnt=0;
struct node{
int l,r;
int num;
} maxx;
signed main(){
freopen("data81.in","r",stdin);
// freopen("mexor.out","w",stdout);
cin>>n;
for(int i=1;i<=n;i++){
cin>>a[i];
b[a[i]]++;
}
int ans=0;
bool flag=false;
int maxx=0,big=0;
for(int i=1;i<=n;i++){
if(b[i]==0){
break;
}
if(b[i]==2){
maxx=i+1;
big=i+1;
continue;
}
if(b[i]==1&&flag==false){
maxx=i+1;
big=i;
flag=1;
}
else if(b[i]==1&&flag==true){
maxx=i+1;
}
}
// cout<<maxx<<' '<<big<<endl;
// cout<<(maxx^3);
for(int i=0;i<=big;i++){
ans=max(ans,maxx^i);
}
cout<<ans<<endl;
fclose(stdin);
// fclose(stdout);
return 0;
}
/*
20
5 6 7 8 4 3 2 1 0 0 1 5 0 7 0 2 3 4 6 9
15
*/
好的 再随便搞点东西
再扔进去点代码
#include<bits/stdc++.h>
using namespace std;
int e[55][55],n,m,q,a[55];
const int inf=0x3f3f3f3f;
int main() {
freopen("andgraph.in","r",stdin);
freopen("andgraph.out","w",stdout);
memset(e,0x3f3f3f3f,sizeof(e));
cin>>n>>m>>q;
for(int i=1;i<=n;i++){
cin>>a[i];
}
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
if(i==j) e[i][j]=0;
if((a[i]&a[j])==0) e[i][j]=inf;
else e[i][j]=(a[i]+a[j]);
}
}
for(int k=1; k<=n; k++)
for(int i=1; i<=n; i++)
for(int j=1; j<=n; j++)
if(e[i][j]>e[i][k]+e[k][j])
e[i][j]=e[i][k]+e[k][j];
while(q--){
int u,v;
cin>>u>>v;
if(u==v){
cout<<2*a[u]<<endl;
continue;
}
if(e[u][v]==inf){
cout<<-1<<endl;
continue;
}
cout<<e[u][v]<<endl;
}
fclose(stdin);
fclose(stdout);
return 0;
}
再放进去一个垃圾链接https://mp.csdn.net/mp_blog/creation/editor?spm=1001.2101.3001.9728
好的 发布!