#include "Joi.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define eb emplace_back
#define forn(x, a, b) for (int x = a; x <= b; ++x)
#define for1(x, a, b) for (int x = a; x >= b; --x)
static const int MAXN = 2e4 + 6;
static int n, m, comp[MAXN], cnt;
static ll X, sz[MAXN];
static vector < int > g[MAXN];
static bool u[MAXN];
void dfs(int v) {
u[v] = 1;
for (auto to : g[v]) {
if (u[to]) continue;
if (sz[comp[v]] == 60)
comp[to] = ++cnt;
else
comp[to] = comp[v];
MessageBoard(to - 1, (X >> sz[comp[to]]) & 1);
sz[comp[to]]++;
dfs(to);
}
}
void Joi(int _n, int _m, int A[], int B[], long long _x, int _t) {
n = _n, m = _m;
int Root = (n < 132 ? 58 : 132);
X = _x;
forn(i, 0, m - 1) {
A[i]++, B[i]++;
g[A[i]].eb(B[i]);
g[B[i]].eb(A[i]);
}
cnt = 1;
comp[Root] = 1;
sz[comp[Root]] = 1;
MessageBoard(Root - 1, X & 1);
dfs(Root);
forn(i, 0, m - 1)
--A[i], --B[i];
}
#ifdef krauch
int main() {
return 0;
}
#endif
#include "Ioi.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define eb emplace_back
#define sz(a) (int)a.size()
#define forn(x, a, b) for (int x = a; x <= b; ++x)
#define for1(x, a, b) for (int x = a; x >= b; --x)
static const int MAXN = 2e4 + 6;
static int n, m, comp[MAXN], cnt, par[MAXN], CUR;
static ll X, sz[MAXN], lvl[MAXN], ans[66];
static vector < int > g[MAXN];
static bool u[MAXN];
void dfs(int v) {
CUR++;
u[v] = 1;
for (auto to : g[v]) {
if (u[to]) continue;
if (sz[comp[v]] == 60)
comp[to] = ++cnt;
else
comp[to] = comp[v];
lvl[to] = sz[comp[to]];
sz[comp[to]]++;
par[to] = v;
dfs(to);
}
}
void dfs2(int v, int val) {
u[v] = 1;
ans[lvl[v]] |= val;
for (auto to : g[v]) {
if (u[to] || comp[to] != comp[v]) continue;
int toval = Move(to - 1);
dfs2(to, toval);
val = Move(v - 1);
}
}
ll Ioi(int _n, int _m, int A[], int B[], int _p, int _v, int _t) {
n = _n, m = _m;
int Root = (n < 132 ? 58 : 132);
int st = _p + 1, stval = _v;
bool ok = 0;
forn(i, 0, m - 1) {
++A[i], ++B[i];
g[A[i]].eb(B[i]);
g[B[i]].eb(A[i]);
}
cnt = 1;
comp[Root] = 1;
sz[comp[Root]] = 1;
dfs(Root);
while (sz[comp[st]] != 60) {
st = par[st];
stval = Move(st - 1);
}
forn(i, 1, n) u[i] = 0;
dfs2(st, stval);
ll res = 0;
forn(i, 0, 60) {
res |= (ans[i] << ll(i));
}
forn(i, 0, m - 1)
--A[i], --B[i];
return res;
}
#ifdef krauch
int main() {
return 0;
}
#endif
Compilation message
Ioi.cpp: In function 'll Ioi(int, int, int*, int*, int, int, int)':
Ioi.cpp:51:10: warning: unused variable 'ok' [-Wunused-variable]
bool ok = 0;
^
Ioi.cpp: At global scope:
Ioi.cpp:16:11: warning: 'X' defined but not used [-Wunused-variable]
static ll X, sz[MAXN], lvl[MAXN], ans[66];
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
1652 KB |
Output is correct |
2 |
Correct |
4 ms |
1912 KB |
Output is correct |
3 |
Correct |
5 ms |
1984 KB |
Output is correct |
4 |
Correct |
4 ms |
2184 KB |
Output is correct |
5 |
Correct |
4 ms |
2240 KB |
Output is correct |
6 |
Correct |
4 ms |
2240 KB |
Output is correct |
7 |
Correct |
4 ms |
2272 KB |
Output is correct |
8 |
Correct |
4 ms |
2324 KB |
Output is correct |
9 |
Correct |
4 ms |
2360 KB |
Output is correct |
10 |
Correct |
4 ms |
2376 KB |
Output is correct |
11 |
Correct |
7 ms |
2624 KB |
Output is correct |
12 |
Correct |
4 ms |
2624 KB |
Output is correct |
13 |
Correct |
4 ms |
2624 KB |
Output is correct |
14 |
Correct |
4 ms |
2624 KB |
Output is correct |
15 |
Correct |
4 ms |
2624 KB |
Output is correct |
16 |
Correct |
4 ms |
2624 KB |
Output is correct |
17 |
Correct |
4 ms |
2624 KB |
Output is correct |
18 |
Correct |
4 ms |
2624 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
30 ms |
5160 KB |
Output is correct |
2 |
Correct |
30 ms |
5352 KB |
Output is correct |
3 |
Correct |
30 ms |
5352 KB |
Output is correct |
4 |
Correct |
17 ms |
5352 KB |
Output is correct |
5 |
Correct |
19 ms |
5352 KB |
Output is correct |
6 |
Correct |
19 ms |
5352 KB |
Output is correct |
7 |
Correct |
17 ms |
5352 KB |
Output is correct |
8 |
Correct |
18 ms |
5352 KB |
Output is correct |
9 |
Correct |
19 ms |
5352 KB |
Output is correct |
10 |
Correct |
17 ms |
5352 KB |
Output is correct |
11 |
Correct |
18 ms |
5352 KB |
Output is correct |
12 |
Correct |
18 ms |
5352 KB |
Output is correct |
13 |
Correct |
17 ms |
5352 KB |
Output is correct |
14 |
Correct |
18 ms |
5352 KB |
Output is correct |
15 |
Correct |
18 ms |
5352 KB |
Output is correct |
16 |
Correct |
17 ms |
5352 KB |
Output is correct |
17 |
Correct |
19 ms |
5352 KB |
Output is correct |
18 |
Correct |
17 ms |
5352 KB |
Output is correct |
19 |
Correct |
20 ms |
5352 KB |
Output is correct |
20 |
Correct |
15 ms |
5352 KB |
Output is correct |
21 |
Correct |
19 ms |
5352 KB |
Output is correct |
22 |
Correct |
18 ms |
5352 KB |
Output is correct |
23 |
Correct |
19 ms |
5352 KB |
Output is correct |
24 |
Correct |
17 ms |
5352 KB |
Output is correct |
25 |
Correct |
18 ms |
5352 KB |
Output is correct |
26 |
Correct |
17 ms |
5352 KB |
Output is correct |
27 |
Correct |
19 ms |
5352 KB |
Output is correct |
28 |
Correct |
18 ms |
5352 KB |
Output is correct |
29 |
Correct |
17 ms |
5352 KB |
Output is correct |
30 |
Correct |
17 ms |
5352 KB |
Output is correct |
31 |
Correct |
5 ms |
5352 KB |
Output is correct |
32 |
Correct |
4 ms |
5352 KB |
Output is correct |
33 |
Correct |
4 ms |
5352 KB |
Output is correct |
34 |
Correct |
4 ms |
5352 KB |
Output is correct |
35 |
Correct |
4 ms |
5352 KB |
Output is correct |
36 |
Correct |
4 ms |
5352 KB |
Output is correct |
37 |
Correct |
4 ms |
5352 KB |
Output is correct |
38 |
Correct |
4 ms |
5352 KB |
Output is correct |
39 |
Correct |
4 ms |
5352 KB |
Output is correct |
40 |
Correct |
4 ms |
5352 KB |
Output is correct |
41 |
Correct |
4 ms |
5352 KB |
Output is correct |
42 |
Correct |
4 ms |
5352 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
5352 KB |
Output is correct |
2 |
Correct |
4 ms |
5352 KB |
Output is correct |
3 |
Correct |
4 ms |
5352 KB |
Output is correct |
4 |
Correct |
6 ms |
5352 KB |
Output is correct |
5 |
Correct |
6 ms |
5352 KB |
Output is correct |
6 |
Correct |
6 ms |
5352 KB |
Output is correct |
7 |
Correct |
6 ms |
5352 KB |
Output is correct |
8 |
Correct |
6 ms |
5352 KB |
Output is correct |
9 |
Correct |
15 ms |
5352 KB |
Output is correct |
10 |
Correct |
15 ms |
5352 KB |
Output is correct |
11 |
Correct |
15 ms |
5352 KB |
Output is correct |
12 |
Correct |
4 ms |
5352 KB |
Output is correct |
13 |
Correct |
4 ms |
5352 KB |
Output is correct |
14 |
Correct |
4 ms |
5352 KB |
Output is correct |
15 |
Correct |
4 ms |
5352 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
40 ms |
5352 KB |
Partially correct |
2 |
Correct |
35 ms |
5352 KB |
Output is correct |
3 |
Correct |
30 ms |
5352 KB |
Output is correct |
4 |
Correct |
17 ms |
5352 KB |
Output is correct |
5 |
Correct |
18 ms |
5352 KB |
Output is correct |
6 |
Correct |
18 ms |
5352 KB |
Output is correct |
7 |
Correct |
19 ms |
5352 KB |
Output is correct |
8 |
Correct |
20 ms |
5352 KB |
Output is correct |
9 |
Correct |
20 ms |
5352 KB |
Output is correct |
10 |
Correct |
18 ms |
5352 KB |
Output is correct |
11 |
Correct |
19 ms |
5352 KB |
Output is correct |
12 |
Correct |
17 ms |
5352 KB |
Output is correct |
13 |
Correct |
18 ms |
5352 KB |
Output is correct |
14 |
Correct |
17 ms |
5352 KB |
Output is correct |
15 |
Partially correct |
19 ms |
5352 KB |
Partially correct |
16 |
Correct |
20 ms |
5352 KB |
Output is correct |
17 |
Correct |
28 ms |
5352 KB |
Output is correct |
18 |
Partially correct |
19 ms |
5352 KB |
Partially correct |
19 |
Partially correct |
19 ms |
5352 KB |
Partially correct |
20 |
Correct |
25 ms |
5352 KB |
Output is correct |
21 |
Correct |
15 ms |
5352 KB |
Output is correct |
22 |
Correct |
18 ms |
5352 KB |
Output is correct |
23 |
Correct |
17 ms |
5352 KB |
Output is correct |
24 |
Correct |
18 ms |
5352 KB |
Output is correct |
25 |
Correct |
18 ms |
5352 KB |
Output is correct |
26 |
Correct |
26 ms |
5352 KB |
Output is correct |
27 |
Correct |
19 ms |
5352 KB |
Output is correct |
28 |
Correct |
30 ms |
5352 KB |
Output is correct |
29 |
Correct |
23 ms |
5352 KB |
Output is correct |
30 |
Correct |
23 ms |
5352 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
35 ms |
5352 KB |
Output is correct |
2 |
Correct |
34 ms |
5364 KB |
Output is correct |
3 |
Correct |
30 ms |
5380 KB |
Output is correct |
4 |
Correct |
18 ms |
5384 KB |
Output is correct |
5 |
Correct |
19 ms |
5384 KB |
Output is correct |
6 |
Correct |
18 ms |
5384 KB |
Output is correct |
7 |
Correct |
18 ms |
5384 KB |
Output is correct |
8 |
Correct |
19 ms |
5384 KB |
Output is correct |
9 |
Correct |
24 ms |
5384 KB |
Output is correct |
10 |
Correct |
22 ms |
5384 KB |
Output is correct |
11 |
Correct |
17 ms |
5384 KB |
Output is correct |
12 |
Correct |
17 ms |
5384 KB |
Output is correct |
13 |
Correct |
20 ms |
5384 KB |
Output is correct |
14 |
Correct |
18 ms |
5384 KB |
Output is correct |
15 |
Correct |
18 ms |
5384 KB |
Output is correct |
16 |
Incorrect |
17 ms |
5384 KB |
Output isn't correct |
17 |
Halted |
0 ms |
0 KB |
- |