답안 #422962

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
422962 2021-06-10T14:56:54 Z alishahali1382 자동 인형 (IOI18_doll) C++14
53 / 100
216 ms 22608 KB
#include "doll.h"
#include<bits/stdc++.h>
#pragma GCC optimize ("O2")
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<pii, pii> pi4;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
#define debug(x) {cerr<<#x<<"="<<x<<"\n";}
#define debug2(x, y) {cerr<<"{"<<#x<<", "<<#y<<"}={"<<x<<", "<<y<<"}\n";}
#define debugp(p) {cerr<<#p<<"={"<<p.first<<", "<<p.second<<"}\n";}
#define debugv(abcd) {cerr<<#abcd<<": ";for (auto dcba:abcd) cerr<<dcba<<", "; cerr<<"\n";}
#define pb push_back
#define SZ(x) ((int)x.size())
#define all(x) x.begin(), x.end()

const int inf=1000001000; // 1e9
const ll INF=10000000010000000ll; // 1e16
const int mod=1000000007;
const int MAXN=300010, LOG=18;

int n, m, k, S;
vi C, X, Y;
vi shit[MAXN];

int Build(vi vec){
	// assert(vec.size());
	if (SZ(vec)==1){
		// debugv(vec)
		// cerr<<"\n";
		return vec[0];
	}
	int v=++S;
	X.pb(inf);
	Y.pb(inf);
	vector<int> vec0, vec1;
	if (SZ(vec)&1) vec0.pb(-v);
	for (int x:vec){
		if (SZ(vec0)==SZ(vec1)) vec0.pb(x);
		else vec1.pb(x);
	}
	
	// debugv(vec)
	// debugv(vec0)
	// debugv(vec1)
	// debug(-v)
	// cerr<<"\n\n";

	int x=Build(vec0);
	int y=Build(vec1);
	X[v-1]=x;
	Y[v-1]=y;
	
	// debugv(vec)
	// debug(-v)
	// debugv(X)
	// debugv(Y)
	// cerr<<"\n\n";

	return -v;
}

void create_circuit(int _m, vi A){
	m=_m;
	n=SZ(A);
	for (int i=1; i<n; i++) shit[A[i-1]].pb(A[i]);
	shit[A.back()].pb(0);
	C.resize(m+1, 0);
	C[0]=A[0];
	for (int i=1; i<=m; i++) if (shit[i].size()) C[i]=Build(shit[i]);
	answer(C, X, Y);
	// debugv(C)
	// debugv(X)
	// debugv(Y)
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 7244 KB Output is correct
2 Correct 37 ms 11096 KB Output is correct
3 Correct 30 ms 10700 KB Output is correct
4 Correct 5 ms 7244 KB Output is correct
5 Correct 16 ms 8396 KB Output is correct
6 Correct 51 ms 12356 KB Output is correct
7 Correct 5 ms 7244 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 7244 KB Output is correct
2 Correct 37 ms 11096 KB Output is correct
3 Correct 30 ms 10700 KB Output is correct
4 Correct 5 ms 7244 KB Output is correct
5 Correct 16 ms 8396 KB Output is correct
6 Correct 51 ms 12356 KB Output is correct
7 Correct 5 ms 7244 KB Output is correct
8 Correct 65 ms 12856 KB Output is correct
9 Correct 65 ms 13356 KB Output is correct
10 Correct 108 ms 15788 KB Output is correct
11 Correct 5 ms 7244 KB Output is correct
12 Correct 5 ms 7244 KB Output is correct
13 Correct 5 ms 7244 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 7244 KB Output is correct
2 Correct 37 ms 11096 KB Output is correct
3 Correct 30 ms 10700 KB Output is correct
4 Correct 5 ms 7244 KB Output is correct
5 Correct 16 ms 8396 KB Output is correct
6 Correct 51 ms 12356 KB Output is correct
7 Correct 5 ms 7244 KB Output is correct
8 Correct 65 ms 12856 KB Output is correct
9 Correct 65 ms 13356 KB Output is correct
10 Correct 108 ms 15788 KB Output is correct
11 Correct 5 ms 7244 KB Output is correct
12 Correct 5 ms 7244 KB Output is correct
13 Correct 5 ms 7244 KB Output is correct
14 Correct 131 ms 17276 KB Output is correct
15 Correct 73 ms 12204 KB Output is correct
16 Correct 115 ms 14764 KB Output is correct
17 Correct 5 ms 7244 KB Output is correct
18 Correct 5 ms 7248 KB Output is correct
19 Correct 5 ms 7244 KB Output is correct
20 Correct 121 ms 16380 KB Output is correct
21 Correct 5 ms 7244 KB Output is correct
22 Correct 5 ms 7244 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 7244 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 5 ms 7244 KB Output is partially correct
2 Correct 83 ms 13156 KB Output is correct
3 Partially correct 147 ms 18848 KB Output is partially correct
4 Partially correct 157 ms 17724 KB Output is partially correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 5 ms 7244 KB Output is partially correct
2 Correct 83 ms 13156 KB Output is correct
3 Partially correct 147 ms 18848 KB Output is partially correct
4 Partially correct 157 ms 17724 KB Output is partially correct
5 Partially correct 168 ms 19364 KB Output is partially correct
6 Partially correct 190 ms 20440 KB Output is partially correct
7 Partially correct 182 ms 20076 KB Output is partially correct
8 Partially correct 202 ms 21220 KB Output is partially correct
9 Partially correct 142 ms 17904 KB Output is partially correct
10 Partially correct 205 ms 22608 KB Output is partially correct
11 Partially correct 216 ms 21688 KB Output is partially correct
12 Partially correct 138 ms 16696 KB Output is partially correct
13 Partially correct 130 ms 15924 KB Output is partially correct
14 Partially correct 123 ms 15684 KB Output is partially correct
15 Partially correct 113 ms 15240 KB Output is partially correct
16 Partially correct 8 ms 7500 KB Output is partially correct
17 Partially correct 110 ms 14644 KB Output is partially correct
18 Partially correct 111 ms 14468 KB Output is partially correct
19 Partially correct 119 ms 15064 KB Output is partially correct
20 Partially correct 151 ms 17268 KB Output is partially correct
21 Partially correct 183 ms 19632 KB Output is partially correct
22 Partially correct 142 ms 16620 KB Output is partially correct