#include <bits/stdc++.h>
#include "Joi.h"
using namespace std;
using ll = long long;
void Joi(int N, int M, int A[], int B[], long long X, int T) {
bool bio[N];
memset(bio, 0, sizeof bio);
int p = 0;
vector<vector<int>> adj(N);
for (int i = 0; i < M; ++i) {
adj[A[i]].push_back(B[i]);
adj[B[i]].push_back(A[i]);
}
for (auto &v: adj) sort(begin(v), end(v));
function<void(int)> dfs = [&](int ver) {
bio[ver] = true;
MessageBoard(ver, (X >> p++) & 1);
p %= 60;
for (auto u: adj[ver]) if (!bio[u]) {
dfs(u);
}
};
dfs(0);
}
#include <bits/stdc++.h>
#include "Ioi.h"
using namespace std;
long long Ioi(int N, int M, int A[], int B[], int P, int V, int T) {
vector<vector<int>> adj(N);
for (int i = 0; i < M; ++i) {
adj[A[i]].push_back(B[i]);
adj[B[i]].push_back(A[i]);
}
for (auto &v: adj) sort(begin(v), end(v));
int col[N];
bool bio[N];
memset(bio, 0, sizeof bio);
int p = 0;
function<void(int)> dfsfind = [&](int ver) {
bio[ver] = true;
col[ver] = p++;
p %= 60;
for (auto u: adj[ver]) if (!bio[u]) {
dfsfind(u);
}
};
dfsfind(0);
memset(bio, 0, sizeof bio);
long long ans = (1ll * V) << col[P];
int cnt = 0;
function<void(int, int)> dfs = [&](int ver, int par) {
if (cnt >= 120) return;
bio[ver] = true;
for (auto u: adj[ver]) if (!bio[u]) {
if (cnt >= 120) return;
++cnt;
long long v = Move(u);
ans |= v << col[u];
dfs(u, ver);
}
if (cnt >= 120) return;
if (par != -1) {
++cnt;
Move(par);
}
};
dfs(P, -1);
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
468 KB |
Wrong Answer [7] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
27 ms |
3908 KB |
Output is correct |
2 |
Correct |
26 ms |
3764 KB |
Output is correct |
3 |
Correct |
25 ms |
3912 KB |
Output is correct |
4 |
Correct |
15 ms |
2364 KB |
Output is correct |
5 |
Correct |
12 ms |
2956 KB |
Output is correct |
6 |
Incorrect |
13 ms |
2748 KB |
Wrong Answer [7] |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
496 KB |
Output is correct |
2 |
Correct |
1 ms |
500 KB |
Output is correct |
3 |
Correct |
1 ms |
488 KB |
Output is correct |
4 |
Correct |
2 ms |
1028 KB |
Output is correct |
5 |
Correct |
3 ms |
1028 KB |
Output is correct |
6 |
Correct |
2 ms |
1056 KB |
Output is correct |
7 |
Correct |
3 ms |
1044 KB |
Output is correct |
8 |
Correct |
2 ms |
1044 KB |
Output is correct |
9 |
Correct |
13 ms |
3772 KB |
Output is correct |
10 |
Correct |
11 ms |
3756 KB |
Output is correct |
11 |
Correct |
11 ms |
3724 KB |
Output is correct |
12 |
Correct |
1 ms |
608 KB |
Output is correct |
13 |
Correct |
1 ms |
492 KB |
Output is correct |
14 |
Correct |
0 ms |
492 KB |
Output is correct |
15 |
Correct |
1 ms |
500 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
26 ms |
3804 KB |
Wrong Answer [7] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
23 ms |
3800 KB |
Wrong Answer [7] |
2 |
Halted |
0 ms |
0 KB |
- |