답안 #815791

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
815791 2023-08-08T23:18:54 Z Lobo 자동 인형 (IOI18_doll) C++17
0 / 100
7 ms 9940 KB
#include "doll.h"
#include<bits/stdc++.h>
using namespace std;
#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define all(x) x.begin(),x.end()
#define int long long

const int inf = 1e18+10;
const int maxn = 2e5+10;

int n, m;
vector<int> g[maxn];

void create_circuit(int32_t M, std::vector<int32_t> A) {
	n = A.size();
	m = M;
	vector<int32_t> c(m+1),x,y;
	vector<int> next;
	for(int i = -1; i < n; i++) {
		int u,v;
		if(i == -1) u = 0, v = A[0];
		else if(i == n-1) u = A[n-1], v = 0;
		else u = A[i], v = A[i+1];

		// g[u].pb(v);
	}

	int cnt = 1;
	vector<int> liga;
	int mult = 1;
	while(next.size() > 1) {
		vector<int> newnext;

		for(int i = 0; i < next.size()/2; i++) {
			newnext.pb(cnt);
			x.pb(mult*next[i]);
			y.pb(mult*next[i+next.size()/2]);
			cnt++;
		}
		if(next.size()%2 == 1) {
			newnext.pb(cnt);
			y.pb(mult*next.back());
			x.pb(0);
			liga.pb(cnt);
			cnt++;
		}
		mult = -1;

		next = newnext;
	}

	for(auto v : liga) {
		x[v-1] = -next[0];
	}

	for(int i = 0; i <= m; i++) {
		c[i] = -next[0];
	}
	
	answer(c,x,y);
}

Compilation message

doll.cpp: In function 'void create_circuit(int32_t, std::vector<int>)':
doll.cpp:23:7: warning: variable 'u' set but not used [-Wunused-but-set-variable]
   23 |   int u,v;
      |       ^
doll.cpp:23:9: warning: variable 'v' set but not used [-Wunused-but-set-variable]
   23 |   int u,v;
      |         ^
doll.cpp:37:20: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |   for(int i = 0; i < next.size()/2; i++) {
      |                  ~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 6 ms 9940 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 6 ms 9940 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 6 ms 9940 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 7 ms 9924 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 6 ms 9940 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 6 ms 9940 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -