Submission #1052793

# Submission time Handle Problem Language Result Execution time Memory
1052793 2024-08-10T22:43:29 Z wood Mechanical Doll (IOI18_doll) C++17
0 / 100
1 ms 1372 KB
#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
void create_circuit(int M, std::vector<int> A) {
	int N = A.size();
	vector<int> res(M+1,-1), x, y;
	res[0] = A[0];
	int logn = 1, size = 1;
	while(size<N){
		size*=2;
		logn++;
	}
	int size2 = size/2;
	bool womp[(int)1e6] = {0};
	function<void(int,int,int,int)> push = [&](int pos,int parent, int lx, int rx) {
		if(rx-lx==1) return;
		if(rx<=size-N) {
			womp[parent] = true;
		}
		int m = (lx+rx)/2;
		push(2*pos,pos, lx,m); push(2*pos+1,pos,m,rx);
	};
	push(1,1,0,size);
	int cnt = 0;
	for(int i = 1; i<=(N+1)/2; i++) {
		cnt++;
		if(womp[i]) {
			x.pb(-1);
			y.pb(-cnt-1);
			continue;
		}
		cnt++;
		x.pb(-cnt);y.pb(-cnt-1);
	}
	vector<int> list = {1};
	while(size2>0){
		int pp = list.size();
		for(int i = 0; i<pp; i++) list.pb(list[i]+size2);
		size2>>=1;
	}
	vector<int> compress;
	for(int i = size-N; i<size; i++) compress.pb(list[i]);
	sort(compress.begin(),compress.end());
	for(int& xx : list) xx = lower_bound(compress.begin(),compress.end(),xx)-compress.begin()+1;
	A.pb(0);
	if(N&1)x.pb(-1);
	for(int i = size-N; i<size; i++){
		if(i&1) y.pb(A[list[i]]);
		else x.pb(A[list[i]]);
	}
	answer(res,x,y);
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 1368 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 1368 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 1368 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 1372 KB wrong serial number
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 1372 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 1372 KB wrong motion
2 Halted 0 ms 0 KB -