#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
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 |
1 |
Correct |
0 ms |
800 KB |
Output is correct |
2 |
Correct |
1 ms |
1312 KB |
Output is correct |
3 |
Correct |
2 ms |
1316 KB |
Output is correct |
4 |
Correct |
1 ms |
788 KB |
Output is correct |
5 |
Correct |
1 ms |
784 KB |
Output is correct |
6 |
Correct |
1 ms |
1300 KB |
Output is correct |
7 |
Correct |
2 ms |
1316 KB |
Output is correct |
8 |
Correct |
2 ms |
1308 KB |
Output is correct |
9 |
Incorrect |
1 ms |
1316 KB |
Wrong Answer [7] |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
36 ms |
25156 KB |
Output is correct |
2 |
Correct |
36 ms |
25284 KB |
Output is correct |
3 |
Correct |
37 ms |
25108 KB |
Output is correct |
4 |
Correct |
27 ms |
23684 KB |
Output is correct |
5 |
Correct |
27 ms |
23768 KB |
Output is correct |
6 |
Correct |
32 ms |
23852 KB |
Output is correct |
7 |
Correct |
31 ms |
23624 KB |
Output is correct |
8 |
Correct |
28 ms |
23512 KB |
Output is correct |
9 |
Incorrect |
27 ms |
23556 KB |
Wrong Answer [7] |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
784 KB |
Output is correct |
2 |
Correct |
1 ms |
788 KB |
Output is correct |
3 |
Correct |
0 ms |
784 KB |
Output is correct |
4 |
Correct |
4 ms |
4416 KB |
Output is correct |
5 |
Correct |
6 ms |
4676 KB |
Output is correct |
6 |
Correct |
4 ms |
4416 KB |
Output is correct |
7 |
Correct |
4 ms |
4420 KB |
Output is correct |
8 |
Correct |
5 ms |
4416 KB |
Output is correct |
9 |
Correct |
24 ms |
23360 KB |
Output is correct |
10 |
Correct |
27 ms |
23388 KB |
Output is correct |
11 |
Correct |
23 ms |
23416 KB |
Output is correct |
12 |
Correct |
1 ms |
788 KB |
Output is correct |
13 |
Correct |
1 ms |
788 KB |
Output is correct |
14 |
Correct |
0 ms |
788 KB |
Output is correct |
15 |
Correct |
0 ms |
804 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
37 ms |
24984 KB |
Output is correct |
2 |
Correct |
40 ms |
24924 KB |
Output is correct |
3 |
Correct |
34 ms |
25140 KB |
Output is correct |
4 |
Correct |
27 ms |
23860 KB |
Output is correct |
5 |
Correct |
28 ms |
23608 KB |
Output is correct |
6 |
Incorrect |
27 ms |
23744 KB |
Wrong Answer [7] |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
43 ms |
25088 KB |
Wrong Answer [7] |
2 |
Halted |
0 ms |
0 KB |
- |