Submission #837949

# Submission time Handle Problem Language Result Execution time Memory
837949 2023-08-25T21:11:27 Z tolbi Mechanical Doll (IOI18_doll) C++17
37 / 100
200 ms 20416 KB
#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
#define coutarr(x) for(auto &it : x) cout<<it<<" ";cout<<endl;
#define tol(bi) (1LL<<((long long)(bi)))
void create_circuit(int M, vector<int> A) {
	int n = A.size();
	vector<int> X(tol(ceil(log2(n+1)))-1);
	vector<int> Y(X.size());
	int S = X.size();
	for (int i = 0; i < S; i++){
		X[i]=(i+1)*2;
		Y[i]=(i+1)*2+1;
	}
	vector<int> gez;
	vector<bool> swit(S,false);
	int node = 1;
	while (gez.size()<S+1){
		if (node>S){
			gez.push_back(node);
			node=1;
		}
		else {
			if (swit[node-1]) swit[node-1]=false;
			else swit[node-1]=true;
			if (!swit[node-1]){
				node=Y[node-1];
			}
			else {
				node=X[node-1];
			}
		}
	}
	map<int,int> mp;
	for (int i = 0; i < n; ++i)
	{
		mp[gez[i]]=A[i];
	}
	mp[gez.back()]=0;
	for (int i = 0; i < S; ++i)
	{
		if (mp.count(X[i])){
			X[i]=mp[X[i]];
		}
		else if (X[i]<=S){
			X[i]=-X[i];
		}
		else X[i]=-1;
		if (mp.count(Y[i])){
			Y[i]=mp[Y[i]];
		}
		else if (Y[i]<=S){
			Y[i]=-Y[i];
		}
		else Y[i]=-1;
	}
	vector<int> C(M+1,-1);
	answer(C,X,Y);
}

Compilation message

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:18:19: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   18 |  while (gez.size()<S+1){
      |         ~~~~~~~~~~^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 212 KB Output is partially correct
2 Partially correct 152 ms 14720 KB Output is partially correct
3 Partially correct 159 ms 15528 KB Output is partially correct
4 Partially correct 189 ms 19904 KB Output is partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 212 KB Output is partially correct
2 Partially correct 152 ms 14720 KB Output is partially correct
3 Partially correct 159 ms 15528 KB Output is partially correct
4 Partially correct 189 ms 19904 KB Output is partially correct
5 Partially correct 187 ms 20416 KB Output is partially correct
6 Partially correct 200 ms 20288 KB Output is partially correct
7 Partially correct 190 ms 20288 KB Output is partially correct
8 Partially correct 187 ms 20032 KB Output is partially correct
9 Partially correct 150 ms 15552 KB Output is partially correct
10 Partially correct 188 ms 19936 KB Output is partially correct
11 Partially correct 199 ms 19928 KB Output is partially correct
12 Partially correct 149 ms 15596 KB Output is partially correct
13 Partially correct 153 ms 15792 KB Output is partially correct
14 Partially correct 157 ms 15796 KB Output is partially correct
15 Partially correct 159 ms 15892 KB Output is partially correct
16 Partially correct 4 ms 852 KB Output is partially correct
17 Correct 91 ms 11972 KB Output is correct
18 Partially correct 147 ms 15532 KB Output is partially correct
19 Partially correct 150 ms 15552 KB Output is partially correct
20 Partially correct 188 ms 19904 KB Output is partially correct
21 Partially correct 183 ms 19904 KB Output is partially correct
22 Partially correct 196 ms 19940 KB Output is partially correct