# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
799306 | 2023-07-31T12:21:22 Z | elotelo966 | Naboj (COCI22_naboj) | C++17 | 98 ms | 21440 KB |
#include <bits/stdc++.h> using namespace std; #define int long long #define OYY 1000000005 #define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); #define mid (start+end)/2 #define mod 1000000007 vector <int> v[200005]; int re[200005]; vector <pair<int,int>> cev; inline void dfs(int node,int ata,int renk){ for(int i=0;i<v[node].size();i++){ int go=v[node][i]; if(go==ata || re[go]!=-1)continue; re[go]=renk^1; //cout<<node<<" "<<renk<<'\n'; cev.push_back({go,renk^1}); dfs(go,ata,renk^1); } } int32_t main(){ faster int n,m;cin>>n>>m; memset(re,-1,sizeof(re)); for(int i=0;i<m;i++){ int a,b;cin>>a>>b; v[a].push_back(b); v[b].push_back(a); } re[1]=0; cev.push_back({1,0}); dfs(1,-1,0); cout<<cev.size()<<'\n'; for(int i=0;i<cev.size();i++){ cout<<cev[i].first<<" "<<cev[i].second<<'\n'; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 6564 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 98 ms | 21440 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 6564 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |