This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "Joi.h"
#include<bits/stdc++.h>
#define ll long long
#define pll pair<ll, ll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ld long double
using namespace std;
void Joi(int n, int m, int u[], int v[], ll x, int t)
{
vector <vector <ll>> A(n);
for (ll i=0; i<m; i++)
A[u[i]].pb(v[i]), A[v[i]].pb(u[i]);
vector <vector <ll>> order(n);
vector <ll> col(n, -1);
auto getfirst60=[&]()
{
ll cnt=0;
function<void(ll)> dfs=[&](ll u)
{
if (cnt>=60) return;
col[u]=cnt++;
for (ll v:A[u])
if (col[v]==-1)
dfs(v);
}; dfs(0);
vector <bool> check(n, 0);
function<void(ll, ll)> dfs1=[&](ll u, ll r)
{
check[u]=1;
if (u!=r) order[r].pb(u);
for (ll v:A[u])
if (!check[v] && col[v]>=0)
dfs1(v, r), order[r].pb(u);
};
for (ll i=0; i<n; i++) if (col[i]>=0)
check.assign(n, 0), dfs1(i, i);
}; getfirst60();
queue <ll> q;
for (ll i=0; i<n; i++)
if (col[i]>=0) q.push(i);
while (!q.empty())
{
ll u=q.front(); q.pop();
for (ll v:A[u]) if (col[v]==-1)
{
col[v]=col[order[u].back()], order[v].pb(u), q.push(v);
for (ll j:order[u]) order[v].pb(j); order[v].pop_back();
}
}
for (ll i=0; i<n; i++) MessageBoard(i, (x>>col[i])&1);
}
#include "Ioi.h"
#include<bits/stdc++.h>
#define ll long long
#define pll pair<ll, ll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ld long double
using namespace std;
ll Ioi(int n, int m, int u[], int v[], int p, int cr, int t)
{
vector <vector <ll>> A(n);
for (ll i=0; i<m; i++)
A[u[i]].pb(v[i]), A[v[i]].pb(u[i]);
vector <vector <ll>> order(n);
vector <ll> col(n, -1);
auto getfirst60=[&]()
{
ll cnt=0;
function<void(ll)> dfs=[&](ll u)
{
if (cnt>=60) return;
col[u]=cnt++;
for (ll v:A[u])
if (col[v]==-1)
dfs(v);
}; dfs(0);
vector <bool> check(n, 0);
function<void(ll, ll)> dfs1=[&](ll u, ll r)
{
check[u]=1;
if (u!=r) order[r].pb(u);
for (ll v:A[u])
if (!check[v] && col[v]>=0)
dfs1(v, r), order[r].pb(u);
};
for (ll i=0; i<n; i++) if (col[i]>=0)
check.assign(n, 0), dfs1(i, i);
}; getfirst60();
queue <ll> q;
for (ll i=0; i<n; i++)
if (col[i]>=0) q.push(i);
while (!q.empty())
{
ll u=q.front(); q.pop();
for (ll v:A[u]) if (col[v]==-1)
{
col[v]=col[order[u].back()], order[v].pb(u), q.push(v);
for (ll j:order[u]) order[v].pb(j); order[v].pop_back();
}
}
ll ans=0;
for (ll i:order[p]) ans|=(ll)Move(i)<<col[i];
return ans;
}
Compilation message (stderr)
Joi.cpp: In function 'void Joi(int, int, int*, int*, long long int, int)':
Joi.cpp:51:13: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
51 | for (ll j:order[u]) order[v].pb(j); order[v].pop_back();
| ^~~
Joi.cpp:51:49: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
51 | for (ll j:order[u]) order[v].pb(j); order[v].pop_back();
| ^~~~~
Ioi.cpp: In function 'long long int Ioi(int, int, int*, int*, int, int, int)':
Ioi.cpp:51:13: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
51 | for (ll j:order[u]) order[v].pb(j); order[v].pop_back();
| ^~~
Ioi.cpp:51:49: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
51 | for (ll j:order[u]) order[v].pb(j); order[v].pop_back();
| ^~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |