# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
529542 | Vimmer | Hiperkocka (COCI21_hiperkocka) | C++14 | 85 ms | 32520 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define in(x) freopen(x, "r", stdin)
#define out(x) freopen(x, "w", stdout)
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("-O3")
#define F first
#define S second
#define PB push_back
#define M ll(998244353)
#define sz(x) (ll)x.size()
#define N 1000005
#define pri(x) cout << x << endl
#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define _ << " " <<
using namespace std;
//typedef tree <ll, null_type, less_equal <ll> , rb_tree_tag, tree_order_statistics_node_update> ordered_set;
//using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef short int si;
typedef unsigned long long ull;
vector <pair <int, int> > g[N];
vector <int> cube;
void dfs(int v, int x, int p)
{
cube[v] = x;
for (auto it : g[v])
{
if (it.F == p)
continue;
dfs(it.F, x ^ (1 << it.S), v);
}
}
int main()
{
istream::sync_with_stdio(0); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
// freopen("1.in", "r", stdin);
// freopen("trains.in", "r", stdin);
// freopen("trains.out", "w", stdout);
int n;
cin >> n;
for (int i = 0; i < n; i++)
{
int x, y;
cin >> x >> y;
g[x].PB({y, i});
g[y].PB({x, i});
}
cube.resize(n + 1);
dfs(0, 0, -1);
vector <vector <int> > ans; ans.clear();
for (int i = 0; i < (1 << n); i++)
if (__builtin_popcount(i) % 2 == 0)
{
ans.emplace_back();
for (auto it : cube)
ans.back().PB(it ^ i);
}
pri(sz(ans));
for (auto it : ans)
{
for (auto itr : it)
cout << itr << " ";
cout << endl;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |