답안 #91840

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
91840 2018-12-30T10:03:30 Z acid 자동 인형 (IOI18_doll) C++14
53 / 100
219 ms 17536 KB
#include "doll.h"
#include <bits/stdc++.h>
std::vector < int > X,Y,C,nx[100005];
void build(int stt,std::vector < int > tar){
	X.push_back(0);
	Y.push_back(0);
	std::vector < int > G[2];
	int i,j,k;
	for(i=0;i<(int)tar.size();++i){
		G[i&1].push_back(tar[i]);
	}
	if((int)tar.size()&1){
		G[1].push_back(tar.back());
		G[0].back()=-stt-1;
	}
	for(i=0;i<2;++i){
		int *T=(i?&Y[stt]:&X[stt]);
		if((int)G[i].size()==1)
			*T=G[i][0];
		else{
			*T=-(int)X.size()-1;
			build((int)X.size(),G[i]);
		}
	}
}
void create_circuit(int M, std::vector<int> A) {
	C.resize(M+1);
	int i,j,k;
	for(i=0;i<(int)A.size();++i){
		nx[A[i]].push_back(i==((int)A.size()-1)?0:A[i+1]);
	}
	C[0]=A[0];
	X.clear();
	Y.clear();
	for(i=1;i<=M;++i){
		if(nx[i].size()==0)
			C[i]=i;
		else if(nx[i].size()==1)
			C[i]=nx[i][0];
		else{
			C[i]=-(int)X.size()-1;
			build((int)X.size(),nx[i]);
		}
	}
	answer(C, X, Y);
}

Compilation message

doll.cpp: In function 'void build(int, std::vector<int>)':
doll.cpp:8:8: warning: unused variable 'j' [-Wunused-variable]
    8 |  int i,j,k;
      |        ^
doll.cpp:8:10: warning: unused variable 'k' [-Wunused-variable]
    8 |  int i,j,k;
      |          ^
doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:28:8: warning: unused variable 'j' [-Wunused-variable]
   28 |  int i,j,k;
      |        ^
doll.cpp:28:10: warning: unused variable 'k' [-Wunused-variable]
   28 |  int i,j,k;
      |          ^
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2636 KB Output is correct
2 Correct 31 ms 6332 KB Output is correct
3 Correct 29 ms 5984 KB Output is correct
4 Correct 2 ms 2636 KB Output is correct
5 Correct 15 ms 3908 KB Output is correct
6 Correct 41 ms 7648 KB Output is correct
7 Correct 2 ms 2636 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2636 KB Output is correct
2 Correct 31 ms 6332 KB Output is correct
3 Correct 29 ms 5984 KB Output is correct
4 Correct 2 ms 2636 KB Output is correct
5 Correct 15 ms 3908 KB Output is correct
6 Correct 41 ms 7648 KB Output is correct
7 Correct 2 ms 2636 KB Output is correct
8 Correct 67 ms 8116 KB Output is correct
9 Correct 82 ms 8820 KB Output is correct
10 Correct 138 ms 11064 KB Output is correct
11 Correct 2 ms 2636 KB Output is correct
12 Correct 2 ms 2636 KB Output is correct
13 Correct 3 ms 2636 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2636 KB Output is correct
2 Correct 31 ms 6332 KB Output is correct
3 Correct 29 ms 5984 KB Output is correct
4 Correct 2 ms 2636 KB Output is correct
5 Correct 15 ms 3908 KB Output is correct
6 Correct 41 ms 7648 KB Output is correct
7 Correct 2 ms 2636 KB Output is correct
8 Correct 67 ms 8116 KB Output is correct
9 Correct 82 ms 8820 KB Output is correct
10 Correct 138 ms 11064 KB Output is correct
11 Correct 2 ms 2636 KB Output is correct
12 Correct 2 ms 2636 KB Output is correct
13 Correct 3 ms 2636 KB Output is correct
14 Correct 121 ms 12576 KB Output is correct
15 Correct 68 ms 7444 KB Output is correct
16 Correct 107 ms 10148 KB Output is correct
17 Correct 3 ms 2636 KB Output is correct
18 Correct 2 ms 2636 KB Output is correct
19 Correct 2 ms 2636 KB Output is correct
20 Correct 111 ms 11628 KB Output is correct
21 Correct 2 ms 2636 KB Output is correct
22 Correct 3 ms 2636 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 2636 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 2 ms 2636 KB Output is partially correct
2 Correct 78 ms 8372 KB Output is correct
3 Partially correct 139 ms 13836 KB Output is partially correct
4 Partially correct 145 ms 12936 KB Output is partially correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 2 ms 2636 KB Output is partially correct
2 Correct 78 ms 8372 KB Output is correct
3 Partially correct 139 ms 13836 KB Output is partially correct
4 Partially correct 145 ms 12936 KB Output is partially correct
5 Partially correct 163 ms 14664 KB Output is partially correct
6 Partially correct 194 ms 15780 KB Output is partially correct
7 Partially correct 174 ms 15420 KB Output is partially correct
8 Partially correct 194 ms 16396 KB Output is partially correct
9 Partially correct 135 ms 13168 KB Output is partially correct
10 Partially correct 219 ms 17536 KB Output is partially correct
11 Partially correct 194 ms 17016 KB Output is partially correct
12 Partially correct 144 ms 12000 KB Output is partially correct
13 Partially correct 132 ms 11276 KB Output is partially correct
14 Partially correct 113 ms 10880 KB Output is partially correct
15 Partially correct 106 ms 10392 KB Output is partially correct
16 Partially correct 6 ms 2892 KB Output is partially correct
17 Partially correct 104 ms 9824 KB Output is partially correct
18 Partially correct 105 ms 10004 KB Output is partially correct
19 Partially correct 120 ms 10352 KB Output is partially correct
20 Partially correct 158 ms 12632 KB Output is partially correct
21 Partially correct 189 ms 15048 KB Output is partially correct
22 Partially correct 139 ms 11896 KB Output is partially correct