답안 #787038

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
787038 2023-07-18T16:56:15 Z APROHACK 자동 인형 (IOI18_doll) C++14
0 / 100
2 ms 340 KB
#include <bits/stdc++.h>
#include "doll.h"
#define ll long long
#define pb push_back
#define ff first
#define ss second
using namespace std;
int n, m, cur;

vector<int>c, x, y;
vector<int>a;

int generar(int desde, int cada, int div){
	if(div == 0){
		return a[desde];
	}
	int posi = cur;
	int real = -(cur + 1);
	x.pb(0);
	y.pb(0);
	cur ++ ;
	x[posi] = generar(desde, cada*2, div-1);
	y[posi] = generar(desde + cada, cada*2, div-1);
	
	return real;
}

void create_circuit(int M, std::vector<int> A) {
	cur = 0;
	a = A;
	n = A.size();
	m = M;
	c.pb(A[0]);
	for(int i = 1 ; i <= M ; i ++)c.pb(-1);
	int k = 1, pot = 0;
	while(k <= a.size()-1 ){
		k *= 2;
		pot ++;
	}
	while(a.size()-1 < k)a.pb(-1);
	a.pop_back();
	a.push_back(0);
	c[A[0]] = generar(1, 1, pot);
	answer(c, x, y);
	
}

Compilation message

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:36:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |  while(k <= a.size()-1 ){
      |        ~~^~~~~~~~~~~~~
doll.cpp:40:19: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   40 |  while(a.size()-1 < k)a.pb(-1);
      |        ~~~~~~~~~~~^~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -