Submission #75360

# Submission time Handle Problem Language Result Execution time Memory
75360 2018-09-09T12:03:36 Z gs14004 Mechanical Doll (IOI18_doll) C++17
47 / 100
157 ms 9680 KB
#include "doll.h"
#include <bits/stdc++.h>
using namespace std;

void dfs(int r, vector<int> &X, vector<int> &Y, vector<int> A){
	if(A.size() == 2){
		X[r-1] = A[0];
		Y[r-1] = A[1];
		return;
	}
	vector<int> L, R;
	for(int i=0; i<A.size(); i++){
		if(i & 1) R.push_back(A[i]);
		else L.push_back(A[i]);
	}
	X[r-1] = -2 * r;
	Y[r-1] = -2 * r - 1;
	dfs(2 * r, X, Y, L);
	dfs(2 * r + 1, X, Y, R);
}

void create_circuit(int M, std::vector<int> A) {
	if(A.size() == 1){
		vector<int> C(M + 1, 0), X, Y;
		C[0] = A[0];
		answer(C, X, Y);
		return;
	}
	vector<int> C(M + 1, -1);
	C[0] = A[0];
	int K = 0;
	while((1 << K) < A.size()) K++;
	A.erase(A.begin());
	while(A.size() < (1 << K)) A.push_back(-1);
	A.back() = 0;
	vector<int> X((1 << K) - 1), Y((1 << K) - 1);
	dfs(1, X, Y, A);
	answer(C, X, Y);
}

Compilation message

doll.cpp: In function 'void dfs(int, std::vector<int>&, std::vector<int>&, std::vector<int>)':
doll.cpp:12:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |  for(int i=0; i<A.size(); i++){
      |               ~^~~~~~~~~
doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:32:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |  while((1 << K) < A.size()) K++;
      |        ~~~~~~~~~^~~~~~~~~~
doll.cpp:34:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   34 |  while(A.size() < (1 << K)) A.push_back(-1);
      |        ~~~~~~~~~^~~~~~~~~~
# 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 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 204 KB Output is partially correct
2 Correct 68 ms 4604 KB Output is correct
3 Partially correct 128 ms 8892 KB Output is partially correct
4 Partially correct 136 ms 9284 KB Output is partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 204 KB Output is partially correct
2 Correct 68 ms 4604 KB Output is correct
3 Partially correct 128 ms 8892 KB Output is partially correct
4 Partially correct 136 ms 9284 KB Output is partially correct
5 Partially correct 141 ms 9648 KB Output is partially correct
6 Partially correct 139 ms 9608 KB Output is partially correct
7 Partially correct 157 ms 9680 KB Output is partially correct
8 Partially correct 136 ms 9440 KB Output is partially correct
9 Partially correct 146 ms 9020 KB Output is partially correct
10 Partially correct 135 ms 9420 KB Output is partially correct
11 Partially correct 157 ms 9244 KB Output is partially correct
12 Partially correct 124 ms 9000 KB Output is partially correct
13 Correct 73 ms 5048 KB Output is correct
14 Partially correct 128 ms 9092 KB Output is partially correct
15 Partially correct 126 ms 9256 KB Output is partially correct
16 Partially correct 5 ms 588 KB Output is partially correct
17 Correct 84 ms 5808 KB Output is correct
18 Correct 74 ms 4648 KB Output is correct
19 Partially correct 123 ms 8908 KB Output is partially correct
20 Partially correct 138 ms 9264 KB Output is partially correct
21 Partially correct 135 ms 9288 KB Output is partially correct
22 Partially correct 134 ms 9252 KB Output is partially correct