Submission #1045102

# Submission time Handle Problem Language Result Execution time Memory
1045102 2024-08-05T16:49:39 Z wood Mechanical Doll (IOI18_doll) C++17
16 / 100
42 ms 12260 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{
				x.pb(adj[i][1]);
				y.pb(adj[i][2]);
				y.pb(adj[i][3]);
			}
		}

	}
	answer(res,x,y);
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 20 ms 6408 KB Output is correct
3 Correct 12 ms 5208 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 5 ms 3932 KB Output is correct
6 Correct 20 ms 7772 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 20 ms 6408 KB Output is correct
3 Correct 12 ms 5208 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 5 ms 3932 KB Output is correct
6 Correct 20 ms 7772 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 24 ms 7308 KB Output is correct
9 Correct 26 ms 8664 KB Output is correct
10 Correct 35 ms 11216 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
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 20 ms 6408 KB Output is correct
3 Correct 12 ms 5208 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 5 ms 3932 KB Output is correct
6 Correct 20 ms 7772 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 24 ms 7308 KB Output is correct
9 Correct 26 ms 8664 KB Output is correct
10 Correct 35 ms 11216 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 10952 KB Output is correct
15 Correct 22 ms 5760 KB Output is correct
16 Correct 36 ms 10172 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 39 ms 12260 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB wrong motion
2 Halted 0 ms 0 KB -