Submission #426453

# Submission time Handle Problem Language Result Execution time Memory
426453 2021-06-14T04:12:29 Z Monchito Mechanical Doll (IOI18_doll) C++14
6 / 100
93 ms 12684 KB
#include "doll.h"
using namespace std;

#define sz(x) (int)x.size()

void create_circuit(int M, vector<int> A) {
	vector<int> C(M+1), X, Y;
       	vector<vector<int>> cnt(M+1); 

	A.push_back(0);

	cnt[0].push_back(A[0]);

	for(int i=0; i<sz(A)-1; i++) cnt[A[i]].push_back(A[i+1]);

	C[0] = A[0];

	for(int i=1; i<M+1; i++) {
		if(cnt[i].empty()) C[i] = i;
	}

	vector<bool> ok(M+1, false);

	int current_s = -1;

	for(int i=0; i<sz(A)-1; i++) {
		if(ok[A[i]]) continue;
		
		if(sz(cnt[A[i]]) == 1) C[A[i]] = cnt[A[i]][0];

		else {
			C[A[i]] = current_s;
			X.push_back(cnt[A[i]][0]);
			Y.push_back(cnt[A[i]][1]);	

			current_s--;
		}

		ok[A[i]] = true;
	}

	answer(C, X, Y);
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 35 ms 6748 KB Output is correct
3 Correct 27 ms 5600 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 13 ms 3788 KB Output is correct
6 Correct 42 ms 8388 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 35 ms 6748 KB Output is correct
3 Correct 27 ms 5600 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 13 ms 3788 KB Output is correct
6 Correct 42 ms 8388 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 57 ms 8332 KB Output is correct
9 Correct 60 ms 9480 KB Output is correct
10 Correct 93 ms 12684 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 35 ms 6748 KB Output is correct
3 Correct 27 ms 5600 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 13 ms 3788 KB Output is correct
6 Correct 42 ms 8388 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 57 ms 8332 KB Output is correct
9 Correct 60 ms 9480 KB Output is correct
10 Correct 93 ms 12684 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Incorrect 80 ms 9720 KB wrong motion
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB wrong motion
2 Halted 0 ms 0 KB -