Submission #776791

#TimeUsernameProblemLanguageResultExecution timeMemory
776791vjudge1Praktični (COCI18_prakticni)C++17
0 / 130
157 ms29844 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...