#include "Joi.h"
#include <vector>
#include <map>
using namespace std;
static vector<vector<int>> adj;
static vector<int> ord;
static map<int, int> bit;
static vector<bool> seen;
static void dfs(int at, int par) {
seen[at] = true;
int b = (int)bit.size();
bit[at] = b % 60;
ord.push_back(at);
for (int it : adj[at]) {
if (seen[it]) continue;
dfs(it, at);
ord.push_back(at);
}
}
void Joi(int N, int M, int A[], int B[], long long X, int T) {
adj.resize(N);
seen.resize(N);
for (int i = 0; i < M; i ++) {
adj[A[i]].push_back(B[i]);
adj[B[i]].push_back(A[i]);
}
dfs(0, -1);
for(int i = 0; i < N; i++){
MessageBoard(i, (X >> bit[i]) & 1);
}
}
#include "Ioi.h"
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
static vector<vector<int>> adj;
static vector<int> ord;
static map<int, int> bit;
static vector<bool> seen;
static void dfs(int at, int par) {
seen[at] = true;
int b = (int)bit.size();
bit[at] = b % 60;
ord.push_back(at);
for (int it : adj[at]) {
if (seen[it]) continue;
dfs(it, at);
ord.push_back(at);
}
}
long long Ioi(int N, int M, int A[], int B[], int P, int V, int T) {
adj.resize(N);
seen.resize(N);
for (int i = 0; i < M; i ++) {
adj[A[i]].push_back(B[i]);
adj[B[i]].push_back(A[i]);
}
dfs(0, -1);
map<int, int> bits;
bits[bit[P]] = V;
int at = find(ord.begin(), ord.end(), P) - ord.begin();
while ((int)bits.size() != 60) {
at = (at + 1) % ord.size();
bits[bit[ord[at]]] = Move(ord[at]);
}
long long X = 0;
for (int i = 0; i < 60; ++i) {
X |= (long long)bits[i] << i;
}
return X;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
488 KB |
Wrong Answer [7] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
33 ms |
5864 KB |
Output is correct |
2 |
Correct |
33 ms |
5848 KB |
Output is correct |
3 |
Correct |
34 ms |
5872 KB |
Output is correct |
4 |
Correct |
22 ms |
3900 KB |
Output is correct |
5 |
Correct |
23 ms |
4612 KB |
Output is correct |
6 |
Correct |
23 ms |
4336 KB |
Output is correct |
7 |
Correct |
22 ms |
4380 KB |
Output is correct |
8 |
Correct |
22 ms |
4492 KB |
Output is correct |
9 |
Correct |
23 ms |
4516 KB |
Output is correct |
10 |
Correct |
19 ms |
3812 KB |
Output is correct |
11 |
Correct |
20 ms |
3876 KB |
Output is correct |
12 |
Correct |
19 ms |
3548 KB |
Output is correct |
13 |
Correct |
19 ms |
3536 KB |
Output is correct |
14 |
Correct |
22 ms |
3544 KB |
Output is correct |
15 |
Correct |
20 ms |
3720 KB |
Output is correct |
16 |
Correct |
20 ms |
3740 KB |
Output is correct |
17 |
Correct |
20 ms |
3744 KB |
Output is correct |
18 |
Correct |
22 ms |
3720 KB |
Output is correct |
19 |
Correct |
20 ms |
3736 KB |
Output is correct |
20 |
Incorrect |
18 ms |
4836 KB |
Wrong Answer [7] |
21 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
504 KB |
Output is correct |
2 |
Correct |
1 ms |
500 KB |
Output is correct |
3 |
Correct |
2 ms |
496 KB |
Output is correct |
4 |
Correct |
3 ms |
1284 KB |
Output is correct |
5 |
Correct |
3 ms |
1284 KB |
Output is correct |
6 |
Correct |
4 ms |
1284 KB |
Output is correct |
7 |
Correct |
3 ms |
1344 KB |
Output is correct |
8 |
Correct |
3 ms |
1376 KB |
Output is correct |
9 |
Correct |
18 ms |
5560 KB |
Output is correct |
10 |
Correct |
18 ms |
5440 KB |
Output is correct |
11 |
Correct |
17 ms |
5500 KB |
Output is correct |
12 |
Correct |
0 ms |
488 KB |
Output is correct |
13 |
Correct |
1 ms |
484 KB |
Output is correct |
14 |
Correct |
0 ms |
488 KB |
Output is correct |
15 |
Correct |
1 ms |
488 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
33 ms |
5888 KB |
Output is correct |
2 |
Partially correct |
32 ms |
5804 KB |
Partially correct |
3 |
Partially correct |
33 ms |
5820 KB |
Partially correct |
4 |
Correct |
22 ms |
3700 KB |
Output is correct |
5 |
Partially correct |
22 ms |
5140 KB |
Partially correct |
6 |
Correct |
22 ms |
4512 KB |
Output is correct |
7 |
Correct |
22 ms |
4408 KB |
Output is correct |
8 |
Correct |
20 ms |
4116 KB |
Output is correct |
9 |
Correct |
22 ms |
4404 KB |
Output is correct |
10 |
Correct |
20 ms |
3852 KB |
Output is correct |
11 |
Correct |
20 ms |
3844 KB |
Output is correct |
12 |
Correct |
19 ms |
3592 KB |
Output is correct |
13 |
Correct |
19 ms |
3580 KB |
Output is correct |
14 |
Correct |
19 ms |
3604 KB |
Output is correct |
15 |
Correct |
20 ms |
3836 KB |
Output is correct |
16 |
Correct |
20 ms |
3792 KB |
Output is correct |
17 |
Correct |
22 ms |
3820 KB |
Output is correct |
18 |
Correct |
24 ms |
3816 KB |
Output is correct |
19 |
Correct |
20 ms |
3732 KB |
Output is correct |
20 |
Incorrect |
18 ms |
4808 KB |
Wrong Answer [7] |
21 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
34 ms |
5864 KB |
Output is correct |
2 |
Correct |
32 ms |
5904 KB |
Output is correct |
3 |
Incorrect |
33 ms |
5800 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |