#include "Joi.h"
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define st first
#define nd second
#define pb push_back
#define MAX 20005
#define sz(x) ((int)x.size())
#define pw(x) (1LL<<(x))
static int Time;
static int beg[MAX];
static bool Bit[MAX],vis[MAX];
static vector<int> v[MAX];
static void createbits(ll x) {
for(int i=0;i<60;i++) Bit[i]=((x>>i)&1);
}
static void dfs(int node,int ata) {
if(vis[node]) return ;
vis[node]=true;
beg[node]=Time++;
MessageBoard(node,Bit[beg[node]%60]);
for(int i:v[node]) {
if(i==ata) continue ;
dfs(i,node);
}
}
void Joi(int N, int M, int A[], int B[], long long X, int T) {
createbits(X);
for(int i=0;i<M;i++) {
v[A[i]].pb(B[i]);
v[B[i]].pb(A[i]);
}
dfs(0,-1);
}
#include "Ioi.h"
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define st first
#define nd second
#define pb push_back
#define MAX 20005
#define sz(x) ((int) x.size())
#define pw(x) (1LL<<(x))
static int sub[MAX],Par[MAX],beg[MAX];
static int Time,total,V,P;
static ll X;
static vector<int> v[MAX],v2[MAX];
static bool vis[MAX];
static void dfs2(int node,int ata) {
if(total==60) return ;
X|=V*pw(beg[node]%60);
for(int i:v2[node]) {
if(i==ata || total==60) continue ;
total++;
V=Move(i);
dfs2(i,node);
if(total<60) V=Move(node);
}
}
static void solve() {
total=1;
while(1) {
if(sub[P]>=60) break ;
P=Par[P];
V=Move(P);
}
dfs2(P,Par[P]);
}
static void dfs(int node,int ata) {
if(vis[node]) return ;
vis[node]=true;
sub[node]=1;
beg[node]=Time++;
Par[node]=ata;
if(~ata) v2[ata].pb(node);
for(int i:v[node]) {
if(i==ata) continue ;
dfs(i,node);
sub[node]+=sub[i];
}
}
long long Ioi(int N, int M, int A[], int B[], int P, int V, int T) {
for(int i=0;i<M;i++) {
v[A[i]].pb(B[i]);
v[B[i]].pb(A[i]);
}
::P=P;
::V=V;
dfs(0,-1);
solve();
return X;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
2272 KB |
Output is correct |
2 |
Incorrect |
8 ms |
2768 KB |
Wrong Answer [7] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
52 ms |
5612 KB |
Output is correct |
2 |
Incorrect |
51 ms |
6664 KB |
Wrong Answer [7] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
6992 KB |
Output is correct |
2 |
Correct |
6 ms |
6992 KB |
Output is correct |
3 |
Correct |
7 ms |
6992 KB |
Output is correct |
4 |
Correct |
10 ms |
6992 KB |
Output is correct |
5 |
Correct |
13 ms |
6992 KB |
Output is correct |
6 |
Correct |
9 ms |
6992 KB |
Output is correct |
7 |
Incorrect |
8 ms |
6992 KB |
Wrong Answer [7] |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
46 ms |
6992 KB |
Output is correct |
2 |
Incorrect |
40 ms |
7344 KB |
Wrong Answer [7] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
50 ms |
7712 KB |
Output is correct |
2 |
Incorrect |
56 ms |
8000 KB |
Wrong Answer [7] |
3 |
Halted |
0 ms |
0 KB |
- |