Submission #713777

# Submission time Handle Problem Language Result Execution time Memory
713777 2023-03-23T03:43:37 Z Astrayt Mechanical Doll (IOI18_doll) C++17
0 / 100
1 ms 340 KB
#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back

void create_circuit(int M, vector<int> A) {
	int N = A.size(), cnt = -1;
 	vector<int> C(M + 1, -1e9), X, Y, S;
	C[0] = A[0];
	A.pb(0);
	for (int i = 0; i < N; ++i) {
		int cur = C[A[i]];
		if(cur == -1e9) C[A[i]] = A[i + 1];
		else{
			int pre = A[i];
			while(cur < 0){
				pre = cur;
				if(S[-cur - 1])	cur = Y[-cur - 1];
				else cur = X[-cur - 1];
				S[-pre - 1] ^= 1;
			}
			if(cur == A[i + 1]) continue;
			if(pre == A[i]){
				C[A[i]] = cnt--;
				X.pb(cur);
				Y.pb(A[i + 1]);
				S.pb(0);
			}else{
				if(S[-pre - 1]){
					X[-pre - 1] = cnt--;
					X.pb(cur);
					Y.pb(A[i + 1]);
				}else{
					Y[-pre - 1] = cnt--;
					X.pb(cur);
					Y.pb(A[i + 1]);
				}
				S.pb(1);
			}
		}
	}
	for(auto &x:C) x = (x == -1e9 ? 1 : x), cerr << x << ' ';
	cerr << '\n';
	for(auto x:X) cerr << x << ' ';
	cerr << '\n';
	for(auto x:Y) cerr << x << ' ';
	cerr << '\n';
	cout << Y[1] << '\n';
 	answer(C, X, Y);
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB DO NOT PRINT ANYTHING TO STANDARD OUTPUT
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB DO NOT PRINT ANYTHING TO STANDARD OUTPUT
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB DO NOT PRINT ANYTHING TO STANDARD OUTPUT
2 Halted 0 ms 0 KB -