Submission #776791

# Submission time Handle Problem Language Result Execution time Memory
776791 2023-07-08T09:33:11 Z vjudge1 Praktični (COCI18_prakticni) C++17
0 / 130
157 ms 29844 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long lo; 

#define fi first
#define se second
#define endl "\n"
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)

const lo inf = 1000000000;
const lo li = 500005;
const lo mod = 1000000007;

int n,m,a[li],k,flag,t,vis[li],pre[li];
int cev;
string s;
vector<pair<int,int>> v[li];
map<pair<int,int>,int> mpp;

inline void dfs(int node,int xorr){
	vis[node]=1;
	for(auto go:v[node]){
		if(go.fi!=pre[node] && vis[go.fi] && (xorr^go.se)){
			printf("1\n%d 1 %d\n",xorr^go.se,mpp[{node,go.fi}]);
			exit(0);
		}
		else{
			if(vis[go.fi]==0){pre[go.fi]=node;dfs(go.fi,xorr^go.se);}
		}
	}
}

int main(void){
	scanf("%d %d",&n,&m);
	for(int i=1;i<=m;i++){
		int x,y,z;
		scanf("%d %d %d",&x,&y,&z);
		v[x].pb({y,z});
		v[y].pb({x,z});
		mpp[{x,y}]=i;
		mpp[{y,x}]=i;
	}
	dfs(1,0);
	printf("0\n");
	return 0;
}

Compilation message

parkticni.cpp: In function 'int main()':
parkticni.cpp:40:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   40 |  scanf("%d %d",&n,&m);
      |  ~~~~~^~~~~~~~~~~~~~~
parkticni.cpp:43:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   43 |   scanf("%d %d %d",&x,&y,&z);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 73 ms 20584 KB There is a simple cycle which is not good
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 35 ms 16048 KB There is a simple cycle which is not good
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 55 ms 20888 KB There is a simple cycle which is not good
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 126 ms 28476 KB There is a simple cycle which is not good
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 76 ms 24168 KB There is a simple cycle which is not good
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 91 ms 24980 KB There is a simple cycle which is not good
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 125 ms 28728 KB There is a simple cycle which is not good
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 157 ms 29844 KB There is a simple cycle which is not good
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 37 ms 17996 KB There is a simple cycle which is not good
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 135 ms 29636 KB There is a simple cycle which is not good
2 Halted 0 ms 0 KB -