#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);
if(P!=0) for(int i=0; i<60; i++) Move(--P);
//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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
876 KB |
Wrong Answer [7] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
19 ms |
2132 KB |
Wrong Answer [7] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
640 KB |
Output is correct |
2 |
Correct |
4 ms |
896 KB |
Output is correct |
3 |
Correct |
4 ms |
640 KB |
Output is correct |
4 |
Correct |
6 ms |
828 KB |
Output is correct |
5 |
Correct |
6 ms |
980 KB |
Output is correct |
6 |
Correct |
6 ms |
964 KB |
Output is correct |
7 |
Correct |
5 ms |
836 KB |
Output is correct |
8 |
Correct |
5 ms |
836 KB |
Output is correct |
9 |
Correct |
11 ms |
1968 KB |
Output is correct |
10 |
Correct |
11 ms |
1592 KB |
Output is correct |
11 |
Correct |
12 ms |
1976 KB |
Output is correct |
12 |
Correct |
4 ms |
772 KB |
Output is correct |
13 |
Correct |
5 ms |
780 KB |
Output is correct |
14 |
Correct |
4 ms |
908 KB |
Output is correct |
15 |
Correct |
3 ms |
780 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
19 ms |
2156 KB |
Wrong Answer [7] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
19 ms |
1904 KB |
Wrong Answer [7] |
2 |
Halted |
0 ms |
0 KB |
- |