답안 #295218

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
295218 2020-09-09T14:27:16 Z SeDunion 자동 인형 (IOI18_doll) C++14
100 / 100
130 ms 11888 KB
#include "doll.h"
#include <bits/stdc++.h>
using namespace std;

const int MAXN = 1<<19;
int t[MAXN], id[MAXN];


void create_circuit(int M, vector<int> A) {
	A.push_back(0);
	int N = A.size();
	int l = 1;
	while (l < N) l<<=1;
	for (int i = 0 ; i < l ; ++ i) t[i+l] = MAXN;
	for (int i = 0, j = 0 ; i < l ; ++ i) {
		id[i] = id[i>>1];
		if (i&1) id[i] |= l;
		id[i] >>= 1;
		if (id[i] >= l-N) t[id[i]+l] = A[j++];
	}
	vector<int> X, Y;
	int r = 0;
	for (int i = l ; --i ; ) {
		int L = i<<1, R = i<<1|1;
		if (t[L] != t[R]) {
			t[i] = --r;
			X.push_back (t[L]);
			Y.push_back (t[R]);
		} else {
			t[i] = t[L];
		}
	}
	for (int i = 0 ; i < abs(r) ; ++ i) {
		if (X[i] == MAXN) X[i] = t[1];
		if (Y[i] == MAXN) Y[i] = t[1];
	}
	vector<int> C(M+1, t[1]);
	// for(int i:C)cout<<i<<" ";cout<<"\n";
	// for(int i:X)cout<<i<<" ";cout<<"\n";
	// for(int i:Y)cout<<i<<" ";cout<<"\n";
	answer (C, X, Y);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 36 ms 5868 KB Output is correct
3 Correct 33 ms 5632 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 12 ms 1484 KB Output is correct
6 Correct 49 ms 7548 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 36 ms 5868 KB Output is correct
3 Correct 33 ms 5632 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 12 ms 1484 KB Output is correct
6 Correct 49 ms 7548 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 63 ms 8892 KB Output is correct
9 Correct 80 ms 9516 KB Output is correct
10 Correct 130 ms 11888 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 36 ms 5868 KB Output is correct
3 Correct 33 ms 5632 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 12 ms 1484 KB Output is correct
6 Correct 49 ms 7548 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 63 ms 8892 KB Output is correct
9 Correct 80 ms 9516 KB Output is correct
10 Correct 130 ms 11888 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 82 ms 11272 KB Output is correct
15 Correct 77 ms 8256 KB Output is correct
16 Correct 103 ms 10896 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 99 ms 11516 KB Output is correct
21 Correct 2 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 204 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 2 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
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 22 ms 4388 KB Output is correct
3 Correct 21 ms 4404 KB Output is correct
4 Correct 28 ms 4904 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 22 ms 4388 KB Output is correct
3 Correct 21 ms 4404 KB Output is correct
4 Correct 28 ms 4904 KB Output is correct
5 Correct 78 ms 10620 KB Output is correct
6 Correct 74 ms 10236 KB Output is correct
7 Correct 104 ms 10392 KB Output is correct
8 Correct 78 ms 9972 KB Output is correct
9 Correct 59 ms 7316 KB Output is correct
10 Correct 72 ms 9260 KB Output is correct
11 Correct 71 ms 9656 KB Output is correct
12 Correct 51 ms 8708 KB Output is correct
13 Correct 51 ms 7816 KB Output is correct
14 Correct 53 ms 7892 KB Output is correct
15 Correct 53 ms 8152 KB Output is correct
16 Correct 2 ms 588 KB Output is correct
17 Correct 60 ms 7144 KB Output is correct
18 Correct 49 ms 8592 KB Output is correct
19 Correct 49 ms 8728 KB Output is correct
20 Correct 71 ms 9716 KB Output is correct
21 Correct 91 ms 9516 KB Output is correct
22 Correct 74 ms 9648 KB Output is correct