Submission #259865

# Submission time Handle Problem Language Result Execution time Memory
259865 2020-08-08T17:48:49 Z medk Mechanical Doll (IOI18_doll) C++14
37 / 100
149 ms 9660 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;
	}
	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))]);
	}
}

void create_circuit(int M, vector<int> A){
	seq.clear(), X.clear(), Y.clear(), C.clear();
	seq=A;
	sz=sz(seq)+1;
	dpth=log2(sz);
	if((1<<dpth)!=sz) dpth++;
	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);
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 256 KB Output is partially correct
2 Partially correct 74 ms 7988 KB Output is partially correct
3 Partially correct 74 ms 8016 KB Output is partially correct
4 Partially correct 90 ms 8756 KB Output is partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 256 KB Output is partially correct
2 Partially correct 74 ms 7988 KB Output is partially correct
3 Partially correct 74 ms 8016 KB Output is partially correct
4 Partially correct 90 ms 8756 KB Output is partially correct
5 Partially correct 97 ms 9660 KB Output is partially correct
6 Partially correct 141 ms 9556 KB Output is partially correct
7 Partially correct 99 ms 9644 KB Output is partially correct
8 Partially correct 91 ms 9316 KB Output is partially correct
9 Partially correct 82 ms 8088 KB Output is partially correct
10 Partially correct 90 ms 9244 KB Output is partially correct
11 Partially correct 149 ms 8848 KB Output is partially correct
12 Partially correct 75 ms 8312 KB Output is partially correct
13 Partially correct 75 ms 8632 KB Output is partially correct
14 Partially correct 78 ms 8704 KB Output is partially correct
15 Partially correct 80 ms 8916 KB Output is partially correct
16 Partially correct 4 ms 588 KB Output is partially correct
17 Correct 62 ms 4912 KB Output is correct
18 Partially correct 77 ms 8288 KB Output is partially correct
19 Partially correct 105 ms 8324 KB Output is partially correct
20 Partially correct 90 ms 9116 KB Output is partially correct
21 Partially correct 86 ms 8876 KB Output is partially correct
22 Partially correct 84 ms 8900 KB Output is partially correct