답안 #1045098

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1045098 2024-08-05T16:46:20 Z wood 자동 인형 (IOI18_doll) C++17
6 / 100
42 ms 11208 KB
#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
void create_circuit(int M, std::vector<int> A) {
	int N = A.size();
	vector<int> adj[M];
	for(int i = 0; i<N; i++){
		if(i<N-1)
		adj[A[i]-1].pb(A[i+1]);
		else adj[A[i]-1].pb(0);
	}
	vector<int> res(M+1), x, y;
	int switchcnt = 0;
	res[0] = A[0];
	for(int i = 0; i<M; i++){
		if(adj[i].size()==1) res[i+1] = adj[i][0];
		if(adj[i].size()==2){
			switchcnt++;
			res[i+1] = -switchcnt;
			x.pb(adj[i][0]);
			y.pb(adj[i][1]);
		}
		if(adj[i].size()>2){
			switchcnt++;
			res[i+1] = -switchcnt;
			switchcnt++; x.pb(-switchcnt);
			switchcnt++; y.pb(-switchcnt);
			x.pb(adj[i][0]);
			if(adj[i].size()==3) {
				y.pb(-switchcnt+2);
				x.pb(adj[i][1]);
				y.pb(adj[i][2]);
			}
			else{
				y.pb(adj[i][1]);
				x.pb(adj[i][2]);
				y.pb(adj[i][3]);
			}
		}

	}
	answer(res,x,y);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 15 ms 6520 KB Output is correct
3 Correct 12 ms 5208 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 6 ms 3932 KB Output is correct
6 Correct 18 ms 7748 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 15 ms 6520 KB Output is correct
3 Correct 12 ms 5208 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 6 ms 3932 KB Output is correct
6 Correct 18 ms 7748 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 25 ms 7384 KB Output is correct
9 Correct 25 ms 8660 KB Output is correct
10 Correct 36 ms 11208 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 15 ms 6520 KB Output is correct
3 Correct 12 ms 5208 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 6 ms 3932 KB Output is correct
6 Correct 18 ms 7748 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 25 ms 7384 KB Output is correct
9 Correct 25 ms 8660 KB Output is correct
10 Correct 36 ms 11208 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 42 ms 10940 KB Output is correct
15 Incorrect 26 ms 7116 KB wrong motion
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB wrong motion
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB wrong motion
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB wrong motion
2 Halted 0 ms 0 KB -