답안 #259850

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
259850 2020-08-08T17:05:02 Z medk 자동 인형 (IOI18_doll) C++14
37 / 100
122 ms 9736 KB
#include <bits/stdc++.h>
#include "doll.h"
#define ll long long
#define pb push_back
#define x first
#define y second
#define sz(u) (int)(u.size())
#define all(u) u.begin(),u.end()

using namespace std;

vector<int> seq,X,Y,C;
int sz,dpth,layer;

void dfs(int u, int d, int v){
	if(d<dpth){
		dfs(u*2,d+1,v);
		dfs(u*2+1,d+1,v+(1<<(d-1)));
		X[u-1]=-u*2; Y[u-1]=X[u-1]-1;
		//cout<<u<<" "<<X[u-1]<<' '<<Y[u-1]<<endl;
	}
	else{
		X[u-1]=(v>=sz-1?-1:seq[v]);
		if(v+(1<<(d-1))==(1<<dpth)-1) Y[u-1]=0;
		else Y[u-1]=(v+(1<<(d-1))>=sz-1?-1:seq[v+(1<<(d-1))]);
		//cout<<u<<" "<<X[u-1]<<' '<<Y[u-1]<<endl;
	}
}

void create_circuit(int M, vector<int> A){
	seq=A;
	sz=sz(seq)+1;
	dpth=ceil(log2(sz));
	layer=(1<<dpth)-1;
	X.resize(layer), Y.resize(layer), C.resize(M+1);
	dfs(1,1,0);
	for(int i=0;i<=M;i++) C[i]=-1;
	answer(C,X,Y);
}
/*
int main(){
	int m,n; cin>>m>>n;
	vector<int> tmp(n);
	for(int i=0;i<n;i++) cin>>tmp[i];
	create_circuit(m,tmp);
}*/
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 204 KB Output is partially correct
2 Partially correct 78 ms 8008 KB Output is partially correct
3 Partially correct 104 ms 7976 KB Output is partially correct
4 Partially correct 117 ms 8744 KB Output is partially correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 204 KB Output is partially correct
2 Partially correct 78 ms 8008 KB Output is partially correct
3 Partially correct 104 ms 7976 KB Output is partially correct
4 Partially correct 117 ms 8744 KB Output is partially correct
5 Partially correct 93 ms 9736 KB Output is partially correct
6 Partially correct 87 ms 9584 KB Output is partially correct
7 Partially correct 92 ms 9644 KB Output is partially correct
8 Partially correct 99 ms 9236 KB Output is partially correct
9 Partially correct 84 ms 8012 KB Output is partially correct
10 Partially correct 82 ms 9200 KB Output is partially correct
11 Partially correct 83 ms 8864 KB Output is partially correct
12 Partially correct 79 ms 8332 KB Output is partially correct
13 Partially correct 122 ms 8728 KB Output is partially correct
14 Partially correct 76 ms 8760 KB Output is partially correct
15 Partially correct 78 ms 8864 KB Output is partially correct
16 Partially correct 4 ms 588 KB Output is partially correct
17 Correct 48 ms 4916 KB Output is correct
18 Partially correct 80 ms 8184 KB Output is partially correct
19 Partially correct 117 ms 8320 KB Output is partially correct
20 Partially correct 90 ms 9064 KB Output is partially correct
21 Partially correct 108 ms 8796 KB Output is partially correct
22 Partially correct 93 ms 8944 KB Output is partially correct