当前位置:网站首页>Two dimensional DFS
Two dimensional DFS
2022-06-26 14:23:00 【Honestbutter-】
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
typedef long long LL;
const int N=20;
int g[N][N],n;
bool st[N];
LL ans;
void dfs(int u,LL x) //x Record answer
{
if(u==n)
{
ans=max(ans,x);
return;
}
int l=0; // First fix the first element
for(int i=1;i<=2*n-1;i++)
if(!st[i])
{
l=i;
break;
}
st[l]=true;
for(int i=l+1;i<=2*n;i++)
if(!st[i]) // Fix the second element again
{
st[i]=true;
dfs(u+1,x^g[l][i]); // Keep searching u+1
st[i]=false;
}
st[l]=false;
}
int main()
{
cin>>n;
for(int i=1;i<=2*n-1;i++)
for(int j=i+1;j<=2*n;j++)
cin>>g[i][j];
dfs(0,0);
cout<<ans<<endl;
return 0;
}
边栏推荐
- 扩展-Hooks
- Sword finger offer 15.65.56 I 56Ⅱ. Bit operation (simple - medium)
- ArcGIS secondary development - arcpy delete layer
- VIM auto fill auto indent explanation
- A标签去掉下划线
- Half search, character array definition, character array uses D11
- Heap optimization dijkstra/hash table storage node number
- ICML 2022 | limo: a new method for rapid generation of targeted molecules
- Online bull Blogger
- MySQL主从复制与读写分离
猜你喜欢

ArcGIS batch render layer script

Eigen(3):error: ‘Eigen’ has not been declared

ICML 2022 | LIMO: 一种快速生成靶向分子的新方法

MySQL主从复制与读写分离

Correlation analysis related knowledge

Free machine learning dataset website (6300+ dataset)

Caelus - full scene offline mixed Department solution

爱可可AI前沿推介(6.26)

Setup instance of layout manager login interface

windows版MySQL软件的安装与卸载
随机推荐
Linear basis count (k large XOR sum)
Use performance to see what the browser is doing
数学建模经验分享:国赛美赛对比/选题参考/常用技巧
DOS command
Chinese output of PostGIS console is garbled
PostGIS create spatial database
Codeforces Global Round 21A~D
GDAL grid data types and their type codes
Heap optimization dijkstra/hash table storage node number
ArcGIS cannot be opened and displays' because afcore cannot be found ' DLL, solution to 'unable to execute code'
服务器创建虚拟环境跑代码
Knowledge about the determination coefficient R2 and the relationship with the correlation coefficient
How to check if a text field is empty or not in swift
扩展-Hooks
Niuke challenge 48 e speed instant forwarding (tree over tree)
Hands on data analysis unit 3 model building and evaluation
How to convert data in cell cell into data in matrix
Linear basis
Related knowledge of libsvm support vector machine
Sword finger offer 18.22.25.52 Double pointer (simple)