답안 #298020

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
298020 2020-09-12T09:51:39 Z miss_robot 자동 인형 (IOI18_doll) C++14
100 / 100
246 ms 13340 KB
#include <bits/stdc++.h>
#include "doll.h"

#pragma GCC optimize("O0")

using namespace std;

int n, m, c = -2;
vector<int> X, Y, mode;

void b(int u, int l, int &j){
	if(l){
		Y[-u-1] = c;
		b(c--, l-1, j);
		if(j){
			X[-u-1] = c;
			b(c--, l-1, j);
		}
		else X[-u-1] = -1;
	}
	else{
		Y[-u-1] = m+1, j--;
		if(j) X[-u-1] = m+1, j--;
		else X[-u-1] = -1;
	}
}

void asg(int u, int t){
	if(mode[-u-1]){
		mode[-u-1] = 0;
		if(Y[-u-1] == m+1) Y[-u-1] = t;
		else asg(Y[-u-1], t);
	}
	else{
		mode[-u-1] = 1;
		if(X[-u-1] == m+1) X[-u-1] = t;
		else asg(X[-u-1], t);
	}
}

void create_circuit(int M, vector<int> A){
	A.push_back(0);
	n = A.size(), m = M;
	vector<int> C(m+1);
	X.resize(2*n), Y.resize(2*n), mode.resize(2*n);
	C[0] = -1;
	for(int i = 1; i <= m; i++) C[i] = -1;
	int l = ceil(log2(n)), t = n;
	b(-1, l-1, t);
	for(int i = 0; i < n; i++) asg(-1, A[i]);
	X.resize(-c-1), Y.resize(-c-1);
	answer(C, X, Y);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 76 ms 4900 KB Output is correct
3 Correct 77 ms 5040 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 12 ms 1356 KB Output is correct
6 Correct 117 ms 7420 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 76 ms 4900 KB Output is correct
3 Correct 77 ms 5040 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 12 ms 1356 KB Output is correct
6 Correct 117 ms 7420 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 138 ms 8756 KB Output is correct
9 Correct 184 ms 9288 KB Output is correct
10 Correct 222 ms 13340 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 76 ms 4900 KB Output is correct
3 Correct 77 ms 5040 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 12 ms 1356 KB Output is correct
6 Correct 117 ms 7420 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 138 ms 8756 KB Output is correct
9 Correct 184 ms 9288 KB Output is correct
10 Correct 222 ms 13340 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 205 ms 12456 KB Output is correct
15 Correct 131 ms 7996 KB Output is correct
16 Correct 208 ms 12248 KB Output is correct
17 Correct 2 ms 224 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 203 ms 12736 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 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 248 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 204 KB Output is correct
2 Correct 138 ms 7332 KB Output is correct
3 Correct 135 ms 7388 KB Output is correct
4 Correct 209 ms 11116 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 204 KB Output is correct
2 Correct 138 ms 7332 KB Output is correct
3 Correct 135 ms 7388 KB Output is correct
4 Correct 209 ms 11116 KB Output is correct
5 Correct 197 ms 12504 KB Output is correct
6 Correct 246 ms 12136 KB Output is correct
7 Correct 214 ms 12148 KB Output is correct
8 Correct 209 ms 11824 KB Output is correct
9 Correct 129 ms 7352 KB Output is correct
10 Correct 231 ms 11744 KB Output is correct
11 Correct 234 ms 11400 KB Output is correct
12 Correct 139 ms 7608 KB Output is correct
13 Correct 140 ms 7988 KB Output is correct
14 Correct 134 ms 8060 KB Output is correct
15 Correct 127 ms 7976 KB Output is correct
16 Correct 4 ms 460 KB Output is correct
17 Correct 122 ms 7344 KB Output is correct
18 Correct 129 ms 7264 KB Output is correct
19 Correct 125 ms 7280 KB Output is correct
20 Correct 214 ms 11444 KB Output is correct
21 Correct 185 ms 11352 KB Output is correct
22 Correct 216 ms 11128 KB Output is correct