답안 #1094495

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1094495 2024-09-29T17:02:47 Z 4QT0R 자동 인형 (IOI18_doll) C++17
6 / 100
72 ms 16688 KB
#include <bits/stdc++.h>
#include "doll.h"
using namespace std;

int iter;
vector<int> tab[200004];
pair<int,int> swt[300004];

void build(int v, vector<int> now){
	vector<int> sep[2];
	for (int i = 0; i<(int)now.size(); i++)sep[i&1].push_back(now[i]);
	if (sep[0].size()==1)swt[-v].first=sep[0][0];
	else{
		swt[-v].first=--iter;
		build(iter,sep[0]);
	}
	if (sep[1].size()==1)swt[-v].second=sep[1][0];
	else if (sep[1].size()){
		swt[-v].second=--iter;
		build(iter,sep[1]);
	}
}

void create_circuit(int m, vector<int> a){
	a.insert(a.begin(),0);
	a.push_back(0);
	int n=a.size();
	vector<int> trig(m+1,0);

	for (int i = 0; i<n-1; i++)tab[a[i]].push_back(a[i+1]);
	for (int i = 0; i<=m; i++){
		if (tab[i].size()==1)trig[i]=tab[i][0];
		else if (tab[i].size()){
			trig[i]=--iter;
			build(iter,tab[i]);
		}
	}
	vector<int> x(-iter);
	vector<int> y(-iter);
	for (int i = 1; i+iter<=0; i++){
		x[i-1]=swt[i].first;
		y[i-1]=swt[i].second;
	}
	answer(trig,x,y);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 5208 KB Output is correct
2 Correct 19 ms 9304 KB Output is correct
3 Correct 20 ms 9044 KB Output is correct
4 Correct 2 ms 4952 KB Output is correct
5 Correct 10 ms 6236 KB Output is correct
6 Correct 25 ms 10940 KB Output is correct
7 Correct 2 ms 4956 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 5208 KB Output is correct
2 Correct 19 ms 9304 KB Output is correct
3 Correct 20 ms 9044 KB Output is correct
4 Correct 2 ms 4952 KB Output is correct
5 Correct 10 ms 6236 KB Output is correct
6 Correct 25 ms 10940 KB Output is correct
7 Correct 2 ms 4956 KB Output is correct
8 Correct 38 ms 12464 KB Output is correct
9 Correct 34 ms 12876 KB Output is correct
10 Correct 48 ms 16688 KB Output is correct
11 Correct 2 ms 5212 KB Output is correct
12 Correct 2 ms 4956 KB Output is correct
13 Correct 2 ms 5148 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 5208 KB Output is correct
2 Correct 19 ms 9304 KB Output is correct
3 Correct 20 ms 9044 KB Output is correct
4 Correct 2 ms 4952 KB Output is correct
5 Correct 10 ms 6236 KB Output is correct
6 Correct 25 ms 10940 KB Output is correct
7 Correct 2 ms 4956 KB Output is correct
8 Correct 38 ms 12464 KB Output is correct
9 Correct 34 ms 12876 KB Output is correct
10 Correct 48 ms 16688 KB Output is correct
11 Correct 2 ms 5212 KB Output is correct
12 Correct 2 ms 4956 KB Output is correct
13 Correct 2 ms 5148 KB Output is correct
14 Incorrect 72 ms 16316 KB state 'Y'
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 5464 KB state 'Y'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 4956 KB state 'Y'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 4956 KB state 'Y'
2 Halted 0 ms 0 KB -