#include "Joi.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MX=10005;
vector<int> adj[MX];
int timer=-1;
vector<int> euler;
int sz[MX], par[MX], tin[MX], tout[MX];
void dfs(int v, int p) {
tin[v]=++timer;
euler.push_back(tin[v]);
sz[v]=1;
par[v]=p;
for(auto u:adj[v]) {
if(u==p) continue;
dfs(u,v);
sz[v]+=sz[u];
}
tout[v]=timer;
}
void Joi(int N, int M, int A[], int B[], long long X, int T) {
for(int i=0;i<N-1;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++) {
int k=i%60;
MessageBoard(euler[i],X>>k&1);
}
}
#include "Ioi.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MX=10005;
vector<int> adj[MX];
int timer=-1;
vector<int> euler;
int sz[MX], par[MX], tin[MX], tout[MX];
void dfs(int v, int p) {
tin[v]=++timer;
euler.push_back(tin[v]);
sz[v]=1;
par[v]=p;
for(auto u:adj[v]) {
if(u==p) continue;
dfs(u,v);
sz[v]+=sz[u];
}
tout[v]=timer;
}
ll get(int x, int y) {
return y*(1LL<<(tin[x]%60));
}
ll res=0;
void dfs0(int v, int p) {
for(auto u:adj[v]) {
if(u==p) continue;
res|=get(u,Move(u));
dfs0(u,v);
Move(v);
}
}
long long Ioi(int N, int M, int A[], int B[], int P, int V, int T) {
for(int i=0;i<N-1;i++) {
adj[A[i]].push_back(B[i]);
adj[B[i]].push_back(A[i]);
}
dfs(0,-1);
int k=V;
while(sz[P]<60) {
P=par[P];
k=Move(P);
}
res|=get(P,k);
dfs0(P,par[P]);
return res;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
1304 KB |
Wrong Answer [7] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
185 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1308 KB |
Output is correct |
2 |
Correct |
1 ms |
1296 KB |
Output is correct |
3 |
Correct |
1 ms |
1304 KB |
Output is correct |
4 |
Incorrect |
2 ms |
1864 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
195 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
151 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |