#include <bits/stdc++.h>
using namespace std;
#include <Joi.h>
void Joi(int n, int m, int *a, int *b, long long x, 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]);
}
vector<bool> visited(n);
auto dfs = [&](int u, auto &self) -> void {
MessageBoard(u, x % 2);
x /= 2;
visited[u] = true;
for (auto c : adj[u]) {
if (!visited[c]) {
self(c, self);
}
}
};
dfs(0, dfs);
}
#include <bits/stdc++.h>
using namespace std;
#include <Ioi.h>
const int L = 4;
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]);
}
vector<int> path;
vector<bool> visited(n);
auto dfs_find = [&](int u, auto &self) -> bool {
visited[u] = true;
if (u == 0) {
return true;
}
for (auto c : adj[u]) {
if (!visited[c] && self(c, self)) {
path.push_back(c);
return true;
}
}
return false;
};
dfs_find(p, dfs_find);
reverse(path.begin(), path.end());
for (auto u : path) {
v = Move(u);
}
int i = 0;
long long ans = 0;
visited.assign(n, false);
auto dfs_read = [&](int u, auto &self) -> bool {
ans |= v * (1LL << i);
if (++i == L) {
return true;
}
visited[u] = true;
for (auto c : adj[u]) {
if (!visited[c]) {
v = Move(c);
if (self(c, self)) {
return true;
}
v = Move(u);
}
}
return false;
};
dfs_read(0, dfs_read);
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
492 KB |
Wrong Answer [7] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
27 ms |
3696 KB |
Wrong Answer [7] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
500 KB |
Wrong Answer [7] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
30 ms |
3808 KB |
Wrong Answer [7] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
26 ms |
3588 KB |
Wrong Answer [7] |
2 |
Halted |
0 ms |
0 KB |
- |