제출 #198067

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
1980672020-01-24 15:14:47DavidDamian자동 인형 (IOI18_doll)C++11
53 / 100
148 ms20116 KiB
#include "doll.h"
using namespace std;
#define debug(x) cerr<<#x<<" = "<<x<<endl
vector<int> destino[100006];
int X[4000006];
int Y[4000006];
int create_tree(int i,int limit,int lv,int sum,int n,int root,int trigger)
{
int last=i;
if(lv==limit-1){
int threshold=(1<<limit)-n;
if(sum<threshold)
X[(i+root-1)-1]=-root;
else
X[(i+root-1)-1]=destino[trigger][sum-threshold];
sum+=(1<<lv);
//debug(sum);
if(sum<threshold)
Y[(i+root-1)-1]=-root;
else
Y[(i+root-1)-1]=destino[trigger][sum-threshold];
}
else{
X[i+root-1-1]=-(2*i+root-1);
last=max(last,create_tree(i*2,limit,lv+1,sum,n,root,trigger));
Y[i+root-1-1]=-(2*i+root);
last=max(last,create_tree(i*2+1,limit,lv+1,sum+(1<<lv),n,root,trigger));
}
return last;
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...