/* In the name of Allah */
#include<bits/stdc++.h>
#include<Joi.h>
using namespace std;
const int N = 1e4 + 5;
vector<int> adj[N], V;
bool mark[N];
void dfs(int u) {
sort(adj[u].begin(), adj[u].end());
mark[u] = true, V.push_back(u);
for (auto v: adj[u])
if (!mark[v])
dfs(v);
}
void Joi(int n, int m, int a[], int b[], long long x, int t) {
for (int u = 0; u < n; u++)
adj[u].clear();
for (int i = 0; i < m; i++) {
adj[a[i]].push_back(b[i]);
adj[b[i]].push_back(a[i]);
}
V.clear(), memset(mark, false, sizeof mark), dfs(0);
for (int i = 0; i < n; i++)
MessageBoard(V[i], i < 60? x >> i & 1: 0);
}
/* In the name of Allah */
#include<bits/stdc++.h>
#include<Ioi.h>
using namespace std;
const int N = 1e4 + 5;
vector<int> adj[N], V;
long long answer;
bool mark[N];
int cur;
bool go(int u) {
mark[u] = true;
if (!u)
return true;
for (auto v: adj[u])
if (!mark[v] && go(v)) {
V.push_back(v);
return true;
}
return false;
}
void dfs(int u, long long b) {
mark[u] = true;
answer |= b << cur++;
sort(adj[u].begin(), adj[u].end());
for (auto v: adj[u])
if (!mark[v] && cur < 60) {
dfs(v, Move(v));
Move(u);
}
}
long long Ioi(int n, int m, int a[], int b[], int p, int v, int t) {
for (int u = answer = cur = 0; u < n; u++)
adj[u].clear();
for (int i = 0; i < m; i++) {
adj[a[i]].push_back(b[i]);
adj[b[i]].push_back(a[i]);
}
V.clear(), memset(mark, false, sizeof mark);
go(p), reverse(V.begin(), V.end());
for (auto u: V)
v = Move(p = u);
memset(mark, false, sizeof mark), dfs(p, v);
return answer;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
1524 KB |
Output is correct |
2 |
Correct |
10 ms |
1400 KB |
Output is correct |
3 |
Correct |
10 ms |
1248 KB |
Output is correct |
4 |
Correct |
11 ms |
1368 KB |
Output is correct |
5 |
Correct |
10 ms |
1552 KB |
Output is correct |
6 |
Correct |
10 ms |
1512 KB |
Output is correct |
7 |
Correct |
10 ms |
1504 KB |
Output is correct |
8 |
Correct |
11 ms |
1356 KB |
Output is correct |
9 |
Correct |
10 ms |
1408 KB |
Output is correct |
10 |
Correct |
10 ms |
1640 KB |
Output is correct |
11 |
Correct |
15 ms |
1796 KB |
Output is correct |
12 |
Correct |
10 ms |
1520 KB |
Output is correct |
13 |
Correct |
10 ms |
1496 KB |
Output is correct |
14 |
Correct |
10 ms |
1504 KB |
Output is correct |
15 |
Correct |
10 ms |
1508 KB |
Output is correct |
16 |
Correct |
10 ms |
1412 KB |
Output is correct |
17 |
Correct |
10 ms |
1512 KB |
Output is correct |
18 |
Correct |
10 ms |
1508 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
39 ms |
4856 KB |
Output is correct |
2 |
Correct |
38 ms |
4860 KB |
Output is correct |
3 |
Correct |
37 ms |
4592 KB |
Output is correct |
4 |
Correct |
26 ms |
3200 KB |
Output is correct |
5 |
Correct |
26 ms |
3524 KB |
Output is correct |
6 |
Correct |
27 ms |
3452 KB |
Output is correct |
7 |
Correct |
26 ms |
3584 KB |
Output is correct |
8 |
Correct |
25 ms |
3312 KB |
Output is correct |
9 |
Correct |
26 ms |
3412 KB |
Output is correct |
10 |
Correct |
24 ms |
3172 KB |
Output is correct |
11 |
Correct |
24 ms |
3180 KB |
Output is correct |
12 |
Correct |
25 ms |
2820 KB |
Output is correct |
13 |
Correct |
25 ms |
2900 KB |
Output is correct |
14 |
Correct |
27 ms |
2860 KB |
Output is correct |
15 |
Correct |
25 ms |
3208 KB |
Output is correct |
16 |
Correct |
25 ms |
3212 KB |
Output is correct |
17 |
Correct |
27 ms |
3212 KB |
Output is correct |
18 |
Correct |
25 ms |
3076 KB |
Output is correct |
19 |
Correct |
31 ms |
3208 KB |
Output is correct |
20 |
Correct |
25 ms |
3356 KB |
Output is correct |
21 |
Correct |
22 ms |
3396 KB |
Output is correct |
22 |
Correct |
26 ms |
3228 KB |
Output is correct |
23 |
Correct |
25 ms |
3312 KB |
Output is correct |
24 |
Correct |
27 ms |
3480 KB |
Output is correct |
25 |
Correct |
25 ms |
3576 KB |
Output is correct |
26 |
Correct |
26 ms |
3312 KB |
Output is correct |
27 |
Correct |
26 ms |
3312 KB |
Output is correct |
28 |
Correct |
26 ms |
3412 KB |
Output is correct |
29 |
Correct |
24 ms |
3104 KB |
Output is correct |
30 |
Correct |
24 ms |
3348 KB |
Output is correct |
31 |
Correct |
10 ms |
1512 KB |
Output is correct |
32 |
Correct |
10 ms |
1384 KB |
Output is correct |
33 |
Correct |
10 ms |
1508 KB |
Output is correct |
34 |
Correct |
10 ms |
1520 KB |
Output is correct |
35 |
Correct |
10 ms |
1388 KB |
Output is correct |
36 |
Correct |
10 ms |
1400 KB |
Output is correct |
37 |
Correct |
10 ms |
1520 KB |
Output is correct |
38 |
Correct |
10 ms |
1280 KB |
Output is correct |
39 |
Correct |
10 ms |
1272 KB |
Output is correct |
40 |
Correct |
10 ms |
1520 KB |
Output is correct |
41 |
Correct |
10 ms |
1408 KB |
Output is correct |
42 |
Correct |
10 ms |
1524 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
1532 KB |
Output is correct |
2 |
Correct |
10 ms |
1524 KB |
Output is correct |
3 |
Correct |
10 ms |
1516 KB |
Output is correct |
4 |
Correct |
11 ms |
1572 KB |
Output is correct |
5 |
Incorrect |
13 ms |
1756 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
39 ms |
4736 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
39 ms |
4592 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |