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 <bits/stdc++.h>
#include "Joi.h"
#define long long long
using namespace std;
const int N = 1e4+5;
static int n, m;
static long val;
static vector<int> g[N];
static bool check[N];
static int ptr;
static void dfs(int u) {
MessageBoard(u, val >> (ptr++) & 1);
ptr %= 60;
check[u] = true;
for(int v : g[u]) if(!check[v])
dfs(v);
}
void Joi(int N, int M, int A[], int B[], long X, int T) {
n = N, m = M, val = X;
for(int i = 0; i < m; ++i) {
g[A[i]].emplace_back(B[i]);
g[B[i]].emplace_back(A[i]);
}
dfs(0);
}
#include <bits/stdc++.h>
#include "Ioi.h"
#define long long long
using namespace std;
const int N = 1e4+5;
static int n, m;
static vector<int> g[N];
static bool check[N];
static int ptr, pos[N];
static vector<int> euler;
static void dfs(int u) {
pos[u] = ptr++;
ptr %= 60;
check[u] = true;
euler.emplace_back(u);
for(int v : g[u]) if(!check[v]) {
dfs(v);
euler.emplace_back(u);
}
}
static int cnt;
static long val;
static bool mark[60];
long Ioi(int N, int M, int A[], int B[], int P, int V, int T) {
n = N, m = M;
for(int i = 0; i < m; ++i) {
g[A[i]].emplace_back(B[i]);
g[B[i]].emplace_back(A[i]);
}
dfs(0);
int z = euler.size();
for(int i = 0; i < z; ++i) euler.emplace_back(euler[i]);
ptr = -1;
while(cnt < 60) {
ptr++;
if(cnt == 0 && euler[ptr] != P) continue;
if(cnt != 0) V = Move(euler[ptr]);
if(!mark[pos[euler[ptr]]]) mark[pos[euler[ptr]]] = true, cnt++;
if(V) val |= 1ll << pos[euler[ptr]];
}
return val;
}
# | 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... |