#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 void dfs(int at, int par) {
int b = (int)bit.size();
bit[at] = b % 60;
ord.push_back(at);
for (int it : adj[at]) {
if (it == par) 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);
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 void dfs(int at, int par) {
int b = (int)bit.size();
bit[at] = b % 60;
ord.push_back(at);
for (int it : adj[at]) {
if (it == par) 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);
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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
492 KB |
Wrong Answer [7] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
218 ms |
262152 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
576 KB |
Output is correct |
2 |
Correct |
1 ms |
492 KB |
Output is correct |
3 |
Correct |
1 ms |
492 KB |
Output is correct |
4 |
Correct |
4 ms |
1316 KB |
Output is correct |
5 |
Correct |
4 ms |
1312 KB |
Output is correct |
6 |
Correct |
4 ms |
1404 KB |
Output is correct |
7 |
Correct |
3 ms |
1316 KB |
Output is correct |
8 |
Correct |
3 ms |
1304 KB |
Output is correct |
9 |
Correct |
17 ms |
5760 KB |
Output is correct |
10 |
Correct |
18 ms |
5724 KB |
Output is correct |
11 |
Correct |
19 ms |
5648 KB |
Output is correct |
12 |
Correct |
1 ms |
488 KB |
Output is correct |
13 |
Correct |
1 ms |
492 KB |
Output is correct |
14 |
Correct |
1 ms |
492 KB |
Output is correct |
15 |
Correct |
1 ms |
488 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
206 ms |
262148 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
244 ms |
262148 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |