#include "Joi.h"
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
mt19937_64 rng(1561561);
int bitas[11000];
vector<int>adj[11000];
set<int>aplankyta;
int t = 0;
void dfs(int v)
{
if (aplankyta.count(v))
return;
aplankyta.insert(v);
t++;
t %= 60;
bitas[v] = t;
for (int x : adj[v])
{
dfs(x);
}
}
void Joi(int N, int M, int A[], int B[], long long X, int T) {
vector<int>PP(N);
iota(PP.begin(), PP.end(), 0);
shuffle(PP.begin(), PP.end(), mt19937_64(15651));
for (int i = 0; i < M; i++)
{
adj[A[i]].push_back(B[i]);
adj[B[i]].push_back(A[i]);
}
for (int i = 0; i < N; i++)
shuffle(adj[i].begin(), adj[i].end(), rng);
dfs(rng() % N);
for (int i = 0; i < N; i++)
{
int s = 0;
if ((X & (1ll << bitas[i])) > 0)
s = 1;
MessageBoard(i, s);
}
}
#include "Ioi.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
mt19937_64 rng(1561561);
int bitas[11000];
vector<int>adj[11000];
set<int>aplankyta;
int t = 0;
void dfs(int v)
{
if (aplankyta.count(v))
return;
t++;
t %= 60;
bitas[v] = t;
aplankyta.insert(v);
for (int x : adj[v])
{
dfs(x);
}
}
long long Ioi(int N, int M, int A[], int B[], int P, int V, int T)
{
vector<int>PP(N);
iota(PP.begin(), PP.end(), 0);
shuffle(PP.begin(), PP.end(), mt19937_64(15651));
for (int i = 0; i < M; i++)
{
adj[A[i]].push_back(B[i]);
adj[B[i]].push_back(A[i]);
}
for (int i = 0; i < N; i++)
shuffle(adj[i].begin(), adj[i].end(), rng);
dfs(rng() % N);
ll X = 0;
vector<int>stak = {P};
set<int>bitai;
set<int>aplankyti;
while (true)
{
X |= V * (1ll << bitas[P]);
bitai.insert(bitas[P]);
aplankyti.insert(P);
if (bitai.size() == 60)
break;
int v1 = -1;
int v2 = -1;
for (int j : adj[P])
if (aplankyti.count(j) == false)
{
v1 = j;
if (bitas[j] == ((bitas[P] + 1) % 60) && bitai.count(bitas[j]) == 0)
v2 = j;
}
if (v2 != -1)
v1 = v2;
if (v1 == -1)
{
stak.pop_back();
v1 = stak.back();
}
else
{
stak.push_back(v1);
}
V = Move(v1);
P = v1;
}
return X;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
1476 KB |
Output is correct |
2 |
Correct |
4 ms |
1468 KB |
Output is correct |
3 |
Correct |
6 ms |
1400 KB |
Output is correct |
4 |
Correct |
4 ms |
1392 KB |
Output is correct |
5 |
Correct |
4 ms |
1140 KB |
Output is correct |
6 |
Correct |
4 ms |
1392 KB |
Output is correct |
7 |
Correct |
4 ms |
1452 KB |
Output is correct |
8 |
Correct |
6 ms |
1408 KB |
Output is correct |
9 |
Correct |
5 ms |
1488 KB |
Output is correct |
10 |
Correct |
5 ms |
1340 KB |
Output is correct |
11 |
Correct |
9 ms |
1708 KB |
Output is correct |
12 |
Correct |
4 ms |
1508 KB |
Output is correct |
13 |
Correct |
4 ms |
1484 KB |
Output is correct |
14 |
Correct |
6 ms |
1452 KB |
Output is correct |
15 |
Correct |
6 ms |
1272 KB |
Output is correct |
16 |
Correct |
6 ms |
1356 KB |
Output is correct |
17 |
Correct |
6 ms |
1408 KB |
Output is correct |
18 |
Correct |
6 ms |
1408 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
55 ms |
5184 KB |
Output is correct |
2 |
Correct |
53 ms |
5184 KB |
Output is correct |
3 |
Correct |
51 ms |
5312 KB |
Output is correct |
4 |
Correct |
31 ms |
3780 KB |
Output is correct |
5 |
Correct |
31 ms |
4160 KB |
Output is correct |
6 |
Correct |
32 ms |
4160 KB |
Output is correct |
7 |
Correct |
31 ms |
4236 KB |
Output is correct |
8 |
Correct |
31 ms |
4316 KB |
Output is correct |
9 |
Correct |
34 ms |
4152 KB |
Output is correct |
10 |
Correct |
44 ms |
3980 KB |
Output is correct |
11 |
Correct |
42 ms |
3896 KB |
Output is correct |
12 |
Correct |
28 ms |
3500 KB |
Output is correct |
13 |
Correct |
28 ms |
3732 KB |
Output is correct |
14 |
Correct |
30 ms |
3760 KB |
Output is correct |
15 |
Correct |
31 ms |
4012 KB |
Output is correct |
16 |
Correct |
30 ms |
3892 KB |
Output is correct |
17 |
Correct |
30 ms |
3788 KB |
Output is correct |
18 |
Correct |
31 ms |
3772 KB |
Output is correct |
19 |
Correct |
31 ms |
3904 KB |
Output is correct |
20 |
Correct |
23 ms |
4252 KB |
Output is correct |
21 |
Correct |
22 ms |
4080 KB |
Output is correct |
22 |
Correct |
31 ms |
4160 KB |
Output is correct |
23 |
Correct |
31 ms |
4288 KB |
Output is correct |
24 |
Correct |
31 ms |
4160 KB |
Output is correct |
25 |
Correct |
28 ms |
4244 KB |
Output is correct |
26 |
Correct |
34 ms |
4412 KB |
Output is correct |
27 |
Correct |
34 ms |
4216 KB |
Output is correct |
28 |
Correct |
32 ms |
4356 KB |
Output is correct |
29 |
Correct |
28 ms |
3928 KB |
Output is correct |
30 |
Correct |
28 ms |
3932 KB |
Output is correct |
31 |
Correct |
4 ms |
1400 KB |
Output is correct |
32 |
Correct |
4 ms |
1340 KB |
Output is correct |
33 |
Correct |
5 ms |
1456 KB |
Output is correct |
34 |
Correct |
5 ms |
1468 KB |
Output is correct |
35 |
Correct |
6 ms |
1368 KB |
Output is correct |
36 |
Correct |
5 ms |
1472 KB |
Output is correct |
37 |
Correct |
5 ms |
1392 KB |
Output is correct |
38 |
Correct |
4 ms |
1400 KB |
Output is correct |
39 |
Correct |
5 ms |
1392 KB |
Output is correct |
40 |
Correct |
4 ms |
1392 KB |
Output is correct |
41 |
Correct |
4 ms |
1400 KB |
Output is correct |
42 |
Correct |
4 ms |
1344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
1264 KB |
Output is correct |
2 |
Correct |
5 ms |
1272 KB |
Output is correct |
3 |
Correct |
4 ms |
1264 KB |
Output is correct |
4 |
Correct |
7 ms |
1884 KB |
Output is correct |
5 |
Correct |
8 ms |
2044 KB |
Output is correct |
6 |
Correct |
7 ms |
2024 KB |
Output is correct |
7 |
Correct |
7 ms |
1808 KB |
Output is correct |
8 |
Correct |
8 ms |
1896 KB |
Output is correct |
9 |
Correct |
23 ms |
4544 KB |
Output is correct |
10 |
Correct |
23 ms |
4760 KB |
Output is correct |
11 |
Correct |
23 ms |
4544 KB |
Output is correct |
12 |
Correct |
4 ms |
1428 KB |
Output is correct |
13 |
Correct |
4 ms |
1400 KB |
Output is correct |
14 |
Correct |
6 ms |
1400 KB |
Output is correct |
15 |
Correct |
5 ms |
1400 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
52 ms |
5104 KB |
Partially correct |
2 |
Partially correct |
53 ms |
5236 KB |
Partially correct |
3 |
Partially correct |
56 ms |
5344 KB |
Partially correct |
4 |
Partially correct |
30 ms |
3640 KB |
Partially correct |
5 |
Correct |
35 ms |
4504 KB |
Output is correct |
6 |
Partially correct |
34 ms |
4160 KB |
Partially correct |
7 |
Correct |
33 ms |
4228 KB |
Output is correct |
8 |
Correct |
31 ms |
4280 KB |
Output is correct |
9 |
Correct |
31 ms |
4160 KB |
Output is correct |
10 |
Correct |
41 ms |
3824 KB |
Output is correct |
11 |
Correct |
41 ms |
3896 KB |
Output is correct |
12 |
Correct |
27 ms |
3496 KB |
Output is correct |
13 |
Partially correct |
27 ms |
3732 KB |
Partially correct |
14 |
Correct |
28 ms |
3764 KB |
Output is correct |
15 |
Partially correct |
31 ms |
3952 KB |
Partially correct |
16 |
Partially correct |
30 ms |
4032 KB |
Partially correct |
17 |
Partially correct |
32 ms |
3744 KB |
Partially correct |
18 |
Partially correct |
31 ms |
3772 KB |
Partially correct |
19 |
Partially correct |
30 ms |
3640 KB |
Partially correct |
20 |
Correct |
23 ms |
4160 KB |
Output is correct |
21 |
Correct |
20 ms |
4060 KB |
Output is correct |
22 |
Correct |
31 ms |
4280 KB |
Output is correct |
23 |
Correct |
31 ms |
4216 KB |
Output is correct |
24 |
Correct |
31 ms |
4156 KB |
Output is correct |
25 |
Correct |
32 ms |
4132 KB |
Output is correct |
26 |
Correct |
31 ms |
4160 KB |
Output is correct |
27 |
Correct |
31 ms |
4160 KB |
Output is correct |
28 |
Correct |
31 ms |
4212 KB |
Output is correct |
29 |
Correct |
28 ms |
3636 KB |
Output is correct |
30 |
Correct |
31 ms |
4196 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
55 ms |
4964 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |