#include "Joi.h"
#include <bits/stdc++.h>
using namespace std;
const int maxn = 10000 + 10;
bool visited[maxn];
int st[maxn], Time = 0;
vector<int> g[maxn];
void dfs(int v){
visited[v] = 1;
st[v] = Time ++;
for (auto u : g[v])
if (!visited[u])
dfs(u);
}
void Joi(int N, int M, int A[], int B[], long long X, int T) {
for (int i = 0; i < M; i++){
g[A[i]].push_back(B[i]);
g[B[i]].push_back(A[i]);
}
for (int i = 0; i < N; i++)
sort(g[i].begin(), g[i].end());
dfs(0);
for (int i = 0; i < N; i++){
bool r = 0;
if (X & (1ll << (st[i] % 60)))
r = 1;
MessageBoard(i, r);
}
}
#include "Ioi.h"
#include <bits/stdc++.h>
using namespace std;
const int maxn = 10000 + 10;
bool visited[maxn];
int st[maxn], Time = 0;
vector<int> g[maxn];
int now, board, cnt = 0;
int b[maxn];
void dfs(int v, int par = -1){
visited[v] = 1;
st[v] = Time ++;
if (now == v)
b[st[v] % 60] = board;
for (auto u : g[v]){
if (!visited[u]){
if (v == now and cnt < 120){
now = u;
cnt ++;
board = Move(u);
}
dfs(u, v);
}
}
if (now == v)
b[st[v] % 60] = board;
if (par != -1 and v == now and cnt < 120){
now = par;
cnt ++;
board = Move(par);
}
}
long long Ioi(int N, int M, int A[], int B[], int P, int V, int T) {
for (int i = 0; i < M; i++){
g[A[i]].push_back(B[i]);
g[B[i]].push_back(A[i]);
}
for (int i = 0; i < N; i++)
sort(g[i].begin(), g[i].end());
memset(b, -1, sizeof b);
now = P;
board = V;
dfs(0);
long long ret = 0;
for (int i = 0; i < 60; i++)
ret += 1ll * b[i] * (1ll << i);
return ret;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
1264 KB |
Output is correct |
2 |
Incorrect |
4 ms |
1404 KB |
Wrong Answer [7] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
33 ms |
4168 KB |
Output is correct |
2 |
Correct |
33 ms |
4352 KB |
Output is correct |
3 |
Incorrect |
33 ms |
4468 KB |
Wrong Answer [7] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
1428 KB |
Output is correct |
2 |
Correct |
4 ms |
1268 KB |
Output is correct |
3 |
Correct |
4 ms |
1268 KB |
Output is correct |
4 |
Correct |
6 ms |
1696 KB |
Output is correct |
5 |
Correct |
6 ms |
1696 KB |
Output is correct |
6 |
Correct |
6 ms |
1696 KB |
Output is correct |
7 |
Correct |
6 ms |
1832 KB |
Output is correct |
8 |
Correct |
5 ms |
1696 KB |
Output is correct |
9 |
Correct |
17 ms |
4000 KB |
Output is correct |
10 |
Correct |
17 ms |
3864 KB |
Output is correct |
11 |
Correct |
17 ms |
3736 KB |
Output is correct |
12 |
Correct |
4 ms |
1368 KB |
Output is correct |
13 |
Correct |
4 ms |
1268 KB |
Output is correct |
14 |
Correct |
4 ms |
1268 KB |
Output is correct |
15 |
Correct |
4 ms |
1296 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
35 ms |
4128 KB |
Output is correct |
2 |
Correct |
34 ms |
4352 KB |
Output is correct |
3 |
Incorrect |
33 ms |
4744 KB |
Wrong Answer [7] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
35 ms |
4160 KB |
Output is correct |
2 |
Incorrect |
33 ms |
4352 KB |
Wrong Answer [7] |
3 |
Halted |
0 ms |
0 KB |
- |