#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 && it != a.end(); ++moves)
{
x |= (long) Move(*it) << id[*it];
++it;
}
return x;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
1164 KB |
Wrong Answer [7] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
33 ms |
4712 KB |
Output is correct |
2 |
Correct |
32 ms |
5428 KB |
Output is correct |
3 |
Correct |
30 ms |
5572 KB |
Output is correct |
4 |
Correct |
19 ms |
5672 KB |
Output is correct |
5 |
Incorrect |
19 ms |
5672 KB |
Wrong Answer [7] |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
5672 KB |
Output is correct |
2 |
Correct |
5 ms |
5672 KB |
Output is correct |
3 |
Correct |
4 ms |
5672 KB |
Output is correct |
4 |
Correct |
7 ms |
5672 KB |
Output is correct |
5 |
Correct |
7 ms |
5672 KB |
Output is correct |
6 |
Correct |
7 ms |
5672 KB |
Output is correct |
7 |
Correct |
8 ms |
5672 KB |
Output is correct |
8 |
Correct |
10 ms |
5672 KB |
Output is correct |
9 |
Correct |
25 ms |
5672 KB |
Output is correct |
10 |
Correct |
20 ms |
5672 KB |
Output is correct |
11 |
Correct |
19 ms |
5672 KB |
Output is correct |
12 |
Correct |
4 ms |
5672 KB |
Output is correct |
13 |
Correct |
4 ms |
5672 KB |
Output is correct |
14 |
Correct |
4 ms |
5672 KB |
Output is correct |
15 |
Correct |
5 ms |
5672 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
46 ms |
5672 KB |
Output is correct |
2 |
Incorrect |
34 ms |
5672 KB |
Wrong Answer [7] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
34 ms |
5672 KB |
Output is correct |
2 |
Correct |
34 ms |
5672 KB |
Output is correct |
3 |
Incorrect |
34 ms |
5672 KB |
Wrong Answer [7] |
4 |
Halted |
0 ms |
0 KB |
- |