# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
799308 | 2023-07-31T12:22:34 Z | elotelo966 | Naboj (COCI22_naboj) | C++17 | 98 ms | 18996 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,1}); dfs(1,-1,1); cout<<cev.size()<<'\n'; for(int i=0;i<cev.size();i++){ cout<<cev[i].first<<" "<<cev[i].second<<'\n'; } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 6484 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 98 ms | 18996 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 6484 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |