| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 744632 | MohamedAhmed04 | Hiperkocka (COCI21_hiperkocka) | C++14 | 47 ms | 3600 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std ;
const int MAX = 17 ;
int arr[MAX] ;
int n ;
vector< vector<int> >adj(MAX) ;
int val[MAX] ;
int cnt = 0 ;
void dfs(int node , int par)
{
for(auto &child : adj[node])
{
if(child == par)
continue ;
val[child] = val[node] ^ (1 << cnt) ;
++cnt ;
dfs(child , node) ;
}
}
int main()
{
ios_base::sync_with_stdio(0) ;
cin.tie(0) ;
cin>>n ;
for(int i = 0 ; i < n ; ++i)
{
int x , y ;
cin>>x>>y ;
adj[x].push_back(y) ;
adj[y].push_back(x) ;
}
dfs(0 , -1) ;
cout<<(1 << (n-1))<<"\n" ;
for(int mask = 0 ; mask < (1 << n) ; ++mask)
{
if((__builtin_popcount(mask) & 1))
continue ;
for(int i = 0 ; i <= n ; ++i)
cout<<(val[i] ^ mask)<<" " ;
cout<<"\n" ;
}
return 0 ;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
