Submission #63518275
Source Code Expand
Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <vector>
#include <queue>
#include <cstdlib>
#include <cstring>
#include <cstdint>
#include <functional>
#include <stack>
#include <map>
#include <random>
#include <ctime>
#include <unordered_set>
#include <unordered_map>
#include <set>
#include <map>
typedef long long LL;
typedef std::pair<int,int> PII;
typedef std::pair<LL,LL> PLL;
typedef unsigned long long ull;
#define rep(i,l,r) for(auto i(l);i<=(r);++i)
#define per(i,r,l) for(auto i(r);i>=(l);--i)
#define rpp(i,l,r) for(auto i(l);i<(r);++i)
#define ppr(i,r,l) for(auto i(r);i>(l);--i)
#define lowbit(x) ((x)&-(x))
#define ls(p) ((p)<<1)
#define rs(p) ((p)<<1|1)
template<typename T>inline T min(T a,T b){return a<b?a:b;}
template<typename T>inline T max(T a,T b){return a>b?a:b;}
const int N = 400010;
const int M = 1000010;
const int mod = 1'000'000'007;
const auto INF = 0x3f3f3f3f3f3f3f3f;
int n,m;
LL ans=0x7fffffffffffffff;
struct edge{
int v;LL w;
};
std::vector<edge> e[N];
std::bitset<N> vis;
void dfs(int u,LL sum){
if(u==n){ans=min(ans,sum);return ;}
vis[u]=1;
for(auto i : e[u]){
if(vis[i.v]){continue;}
dfs(i.v,sum^i.w);
}
vis[u]=0;
}
int main(){
scanf("%d%d",&n,&m);
while(m--){
int u,v;LL w;scanf("%d%d%lld",&u,&v,&w);
e[u].push_back({v,w});
e[v].push_back({u,w});
}
dfs(1,0);
printf("%lld\n",ans);
return 0;
}
/*
-std=c++14
-Wall -O2 -static
-Wall -O2 -fsanitize=address,undefined
LHY qingchunkeai,shanliangdafang,wengrouxianhui,meilidongren,chenyuluoyan,biyuexiuhua.
Genshin Impact
LJ tql.
*/
Submission Info
Submission Time |
|
Task |
D - Minimum XOR Path |
User |
Xr0805 |
Language |
C++ 20 (gcc 12.2) |
Score |
400 |
Code Size |
1753 Byte |
Status |
AC |
Exec Time |
4 ms |
Memory |
3936 KB |
Compile Error
Main.cpp: In function ‘int main()’:
Main.cpp:62:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
62 | scanf("%d%d",&n,&m);
| ~~~~~^~~~~~~~~~~~~~
Main.cpp:65:27: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
65 | int u,v;LL w;scanf("%d%d%lld",&u,&v,&w);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
400 / 400 |
Status |
|
|
Set Name |
Test Cases |
Sample |
00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt |
All |
00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_test_00.txt, 01_test_01.txt, 01_test_02.txt, 01_test_03.txt, 01_test_04.txt, 01_test_05.txt, 01_test_06.txt, 01_test_07.txt, 01_test_08.txt, 01_test_09.txt, 01_test_10.txt, 01_test_11.txt, 01_test_12.txt, 01_test_13.txt, 01_test_14.txt, 01_test_15.txt, 01_test_16.txt, 01_test_17.txt, 01_test_18.txt, 01_test_19.txt, 01_test_20.txt, 01_test_21.txt, 01_test_22.txt, 01_test_23.txt, 01_test_24.txt, 01_test_25.txt, 01_test_26.txt, 01_test_27.txt, 01_test_28.txt |
Case Name |
Status |
Exec Time |
Memory |
00_sample_00.txt |
AC |
3 ms |
3728 KB |
00_sample_01.txt |
AC |
3 ms |
3792 KB |
00_sample_02.txt |
AC |
2 ms |
3796 KB |
01_test_00.txt |
AC |
3 ms |
3668 KB |
01_test_01.txt |
AC |
2 ms |
3800 KB |
01_test_02.txt |
AC |
2 ms |
3672 KB |
01_test_03.txt |
AC |
2 ms |
3936 KB |
01_test_04.txt |
AC |
3 ms |
3864 KB |
01_test_05.txt |
AC |
3 ms |
3788 KB |
01_test_06.txt |
AC |
2 ms |
3796 KB |
01_test_07.txt |
AC |
3 ms |
3680 KB |
01_test_08.txt |
AC |
2 ms |
3864 KB |
01_test_09.txt |
AC |
3 ms |
3704 KB |
01_test_10.txt |
AC |
2 ms |
3680 KB |
01_test_11.txt |
AC |
2 ms |
3936 KB |
01_test_12.txt |
AC |
2 ms |
3800 KB |
01_test_13.txt |
AC |
2 ms |
3720 KB |
01_test_14.txt |
AC |
3 ms |
3740 KB |
01_test_15.txt |
AC |
3 ms |
3932 KB |
01_test_16.txt |
AC |
3 ms |
3672 KB |
01_test_17.txt |
AC |
3 ms |
3676 KB |
01_test_18.txt |
AC |
2 ms |
3860 KB |
01_test_19.txt |
AC |
4 ms |
3796 KB |
01_test_20.txt |
AC |
4 ms |
3868 KB |
01_test_21.txt |
AC |
4 ms |
3680 KB |
01_test_22.txt |
AC |
4 ms |
3816 KB |
01_test_23.txt |
AC |
4 ms |
3820 KB |
01_test_24.txt |
AC |
3 ms |
3592 KB |
01_test_25.txt |
AC |
3 ms |
3808 KB |
01_test_26.txt |
AC |
3 ms |
3680 KB |
01_test_27.txt |
AC |
2 ms |
3864 KB |
01_test_28.txt |
AC |
3 ms |
3932 KB |