Submission #1041732

# Submission time Handle Problem Language Result Execution time Memory
1041732 2024-08-02T07:34:24 Z ReLice Mechanical Doll (IOI18_doll) C++17
0 / 100
37 ms 9820 KB
#include "doll.h"
#include <bits/stdc++.h>
#define ll int
#define vll vector<ll>
#define pb push_back
#define sz size()
using namespace std;
vll x(400000,0),y(400000,0),c;
vector<vll> v;
ll n;
void build(ll v,ll tl,ll tr){
	if(tl+1>=tr){
		x[v-1]=y[v-1]=1;
		if(tr>=n)y[v-1]=0;
		if(tl>=n)y[v-1]=0;
		//~ cout<<-v<<' '<<x[v-1]<<' '<<y[v-1]<<endl;
		return;
	}ll tm=(tl+tr)/2;
	x[v-1]=-v*2;
	y[v-1]=-v*2-1;
	//~ cout<<-v<<' '<<x[v-1]<<' '<<y[v-1]<<endl;
	build(v*2,tl,tm);
	build(v*2+1,tm+1,tr);
}
void create_circuit(int m, std::vector<int> a) {
	n = a.size();
	ll i;
	c.resize(m+1,0);
	c[0]=a[0];
	c[1]=-1;
	build(1,1,n);
	ll s=1;
	vector<bool> f(400,0);
	for(i=0;i<10;i++){
		//~ cout<<s<<' ';
		if(s==0)break;
		if(s>0){
			s=c[s];
		}else {
			if(f[-s]){
				f[-s]=!f[-s];
				s=y[-s-1];
			}else {
				f[-s]=!f[-s];
				s=x[-s-1];
			}
		}
	}
	//~ cout<<endl;
	answer(c, x, y);
}
# Verdict Execution time Memory Grader output
1 Incorrect 29 ms 9820 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 29 ms 9820 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 29 ms 9820 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 32 ms 9820 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 37 ms 9820 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 37 ms 9820 KB wrong motion
2 Halted 0 ms 0 KB -