#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], t[maxn];
int now, board, cnt = 0;
int b[maxn];
void dfs(int v, int par = -1){
if (now == v)
b[st[v] % 60] = board;
for (auto u : t[v]){
if (u != par){
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);
}
}
void DFS(int v){
visited[v] = 1;
st[v] = Time ++;
for (auto u : g[v]){
if (!visited[u]){
t[v].push_back(u);
t[u].push_back(v);
DFS(u);
}
}
}
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);
DFS(0);
now = P;
board = V;
dfs(P);
long long ret = 0;
for (int i = 0; i < 60; i++)
ret += 1ll * b[i] * (1ll << i);
return ret;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
1392 KB |
Wrong Answer [7] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
37 ms |
4672 KB |
Wrong Answer [7] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
1656 KB |
Output is correct |
2 |
Correct |
5 ms |
1520 KB |
Output is correct |
3 |
Correct |
6 ms |
1684 KB |
Output is correct |
4 |
Correct |
8 ms |
1936 KB |
Output is correct |
5 |
Correct |
8 ms |
2000 KB |
Output is correct |
6 |
Correct |
7 ms |
2064 KB |
Output is correct |
7 |
Correct |
8 ms |
2132 KB |
Output is correct |
8 |
Correct |
6 ms |
2136 KB |
Output is correct |
9 |
Correct |
18 ms |
4280 KB |
Output is correct |
10 |
Correct |
18 ms |
4380 KB |
Output is correct |
11 |
Correct |
18 ms |
4268 KB |
Output is correct |
12 |
Correct |
4 ms |
1392 KB |
Output is correct |
13 |
Correct |
5 ms |
1524 KB |
Output is correct |
14 |
Correct |
5 ms |
1520 KB |
Output is correct |
15 |
Correct |
4 ms |
1520 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
35 ms |
4804 KB |
Wrong Answer [7] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
36 ms |
4672 KB |
Output is correct |
2 |
Correct |
38 ms |
4680 KB |
Output is correct |
3 |
Incorrect |
39 ms |
4868 KB |
Wrong Answer [7] |
4 |
Halted |
0 ms |
0 KB |
- |