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 <vector>
using namespace std;
#define long long long
static const int N = 1e4 + 2;
int GetBit(long x, int idx) { return (x >> idx) & 1; }
static vector<int> g[N];
static bool vst[N];
static int tme = 0;
static long mess;
static void Dfs(int u)
{
vst[u] = true;
MessageBoard(u, GetBit(mess, tme++ % 60));
for (int v: g[u])
if (!vst[v])
Dfs(v);
}
void Joi(int n, int m, int A[], int B[], long _mess, int subtask)
{
mess = _mess;
for (int i = 0; i < m; ++i)
{
g[A[i]].push_back(B[i]);
g[B[i]].push_back(A[i]);
}
Dfs(1);
}
#include "Ioi.h"
#include <algorithm>
#include <vector>
#define long long long
using namespace std;
static const int N = 1e4 + 2;
static vector<int> g[N];
static bool vst[N];
static int tme = 0, id[N];
static vector<int> a;
static void Dfs(int u)
{
vst[u] = true;
id[u] = tme++ % 60;
for (int v: g[u])
if (!vst[v])
{
a.push_back(v);
Dfs(v);
a.push_back(u);
}
}
long Ioi(int n, int m, int A[], int B[], int start, int num, int subtask)
{
for (int i = 0; i < m; ++i)
{
g[A[i]].push_back(B[i]);
g[B[i]].push_back(A[i]);
}
Dfs(1);
a.insert(a.end(), a.begin(), a.end());
long x = 0;
x |= (long) num << id[start];
auto it = ++find(a.begin(), a.end(), start);
for (int moves = 0; moves < 120; ++moves)
{
x |= (long) Move(*it) << id[*it];
++it;
}
return x;
}
# | 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... |