#include "Joi.h"
#include<vector>
#include<stdio.h>
using namespace std;
#define MAXN 10005
int b[60];
/*int dp[MAXN][60];
bool chk[MAXN];
vector<int> e[MAXN];
void dfsj(int x){
int mx=0;
chk[x]=true;
for(int i=1; i<60; i++) if(dp[x][i]>dp[x][mx]) mx=i;
//printf("%d %d\n", x, mx);
MessageBoard(x, b[mx]);
dp[x][mx]=0;
for(int i=0; i<e[x].size(); i++) if(!chk[e[x][i]]){
for(int j=0; j<60; j++) dp[e[x][i]][j]=dp[x][j]+1;
dfsj(e[x][i]);
}
}
void Joi(int N, int M, int A[], int B[], long long X, int T) {
for(int i=0; i<60; i++) b[i]=(X&(1<<i))!=0?1:0;
for(int i=0; i<N; i++) for(int j=0; j<60; j++) dp[i][j]=60;
for(int i=0; i<M; i++){
e[A[i]].push_back(B[i]);
e[B[i]].push_back(A[i]);
}
dfsj(0);
}*/
void Joi(int N, int M, int A[], int B[], long long X, int T) {
for(int i=0; i<60; i++) b[i]=(X&(1ll<<i))!=0?1:0;
for(int i=0; i<N; i++) MessageBoard(i, b[i%60]);
}
#include "Ioi.h"
#include<vector>
#define MAXN 10005
using namespace std;
/*
int dis[MAXN][60], a[MAXN][60];
bool ch[MAXN];
vector<int> ed[MAXN];
int num[MAXN];
int ans[60];
void dfsi(int x){
int mx=0;
ch[x]=true;
for(int i=1; i<60; i++) if(dis[x][i]>dis[x][mx]) mx=i;
printf("%d#\n", mx);
dis[x][mx]=0;
a[x][mx]=x;
for(int i=0; i<ed[x].size(); i++) if(!ch[ed[x][i]]){
for(int j=0; j<60; j++){
dis[ed[x][i]][j]=dis[x][j]+1;
a[ed[x][i]][j]=a[x][j];
}
dfsi(ed[x][i]);
}
}
void dfs(int x){
ch[x]=true;
for(int i=0; i<ed[x].size(); i++) if(!ch[ed[x][i]]&&num[ed[x][i]]!=-1){
ans[num[ed[x][i]]]=Move(ed[x][i]);
dfs(ed[x][i]);
}
}
long long Ioi(int N, int M, int A[], int B[], int P, int V, int T) {
long long k=0;
for(int i=0; i<N; i++) for(int j=0; j<60; j++){
dis[i][j]=60;
a[i][j]=-1;
}
for(int i=0; i<M; i++){
ed[A[i]].push_back(B[i]);
ed[B[i]].push_back(A[i]);
}
dfsi(0);
for(int i=0; i<N; i++) num[i]=-1;
for(int i=0; i<60; i++){
num[a[P][i]]=i;
if(a[P][i]==P) ans[i]=V;
}
for(int i=0; i<60; i++) printf("%d %d\n", i, num[i]);
for(int i=0; i<N; i++) ch[i]=false;
dfs(P);
for(int i=0; i<60; i++) k+=(1<<i)*ans[i];
return k;
}
*/
long long Ioi(int N, int M, int A[], int B[], int P, int V, int T) {
long long k=0;
if(P==0) k=V;
else for(; P%60!=0; P--) k=Move(P-1);
//printf("%d\n", P);
for(int i=1; i<60; i++){
k+=(1ll<<i)*Move(P+i);
//printf("%lld*", k);
}
//printf("%lld\n", k);
return k;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
780 KB |
Wrong Answer [7] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
20 ms |
2460 KB |
Wrong Answer [7] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
784 KB |
Output is correct |
2 |
Correct |
4 ms |
780 KB |
Output is correct |
3 |
Incorrect |
4 ms |
888 KB |
Wrong Answer [6] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
20 ms |
2332 KB |
Wrong Answer [7] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
20 ms |
2340 KB |
Wrong Answer [7] |
2 |
Halted |
0 ms |
0 KB |
- |