Submission #1041542

# Submission time Handle Problem Language Result Execution time Memory
1041542 2024-08-02T05:27:18 Z yanb Mechanical Doll (IOI18_doll) C++14
6 / 100
38 ms 14596 KB
#include <bits/stdc++.h>

using namespace std;
    
//#define int long long
//#define pii pair<long long, long long>

void answer(vector<signed> C, vector<signed> X, vector<signed> Y);

void create_circuit(int k, vector<int> a) {
	int n = a.size();
	a.push_back(0);
	vector<vector<int>> g(k + 1);
	g[0].push_back(a[0]);
	for (int i = 0; i < n; i++) {
		g[a[i]].push_back(a[i + 1]);
	}

	vector<int> C(k + 1), X(4e5), Y(4e5);
	int nots = 0;
	for (int i = 0; i < k + 1; i++) {
		if (g[i].size() == 0) continue;
		if (g[i].size() == 1) {
			C[i] = g[i][0]; continue;
		}
		C[i] = -nots - 1;
		X[nots] = g[i][0];
		Y[nots] = g[i][1];
		nots++;
		for (int j = 1; j < (int) g[i].size() - 1; j++) {
			X[nots] = Y[nots - 1];
			Y[nots - 1] = -nots - 1;
			Y[nots] = g[i][j + 1];
			nots++;
		}
	}

	X.resize(nots);
	Y.resize(nots);

	answer(C, X, Y);
}

#ifdef ONLINE_JUDGE
void answer(vector<signed> C, vector<signed> X, vector<signed> Y) {
	for (int x : C) cout << x << " ";
	cout << "\n";
	for (int x : X) cout << x << " ";
	cout << "\n";
	for (int x : Y) cout << x << " ";
	cout << "\n";
}

int main() {
	create_circuit(4, {1, 2, 1, 3, 1, 4});
}
#endif
# Verdict Execution time Memory Grader output
1 Correct 2 ms 3420 KB Output is correct
2 Correct 18 ms 10028 KB Output is correct
3 Correct 13 ms 8792 KB Output is correct
4 Correct 1 ms 3564 KB Output is correct
5 Correct 7 ms 7004 KB Output is correct
6 Correct 20 ms 11380 KB Output is correct
7 Correct 1 ms 3420 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 3420 KB Output is correct
2 Correct 18 ms 10028 KB Output is correct
3 Correct 13 ms 8792 KB Output is correct
4 Correct 1 ms 3564 KB Output is correct
5 Correct 7 ms 7004 KB Output is correct
6 Correct 20 ms 11380 KB Output is correct
7 Correct 1 ms 3420 KB Output is correct
8 Correct 24 ms 10632 KB Output is correct
9 Correct 27 ms 12376 KB Output is correct
10 Correct 38 ms 14596 KB Output is correct
11 Correct 2 ms 3416 KB Output is correct
12 Correct 1 ms 3416 KB Output is correct
13 Correct 1 ms 3420 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 3420 KB Output is correct
2 Correct 18 ms 10028 KB Output is correct
3 Correct 13 ms 8792 KB Output is correct
4 Correct 1 ms 3564 KB Output is correct
5 Correct 7 ms 7004 KB Output is correct
6 Correct 20 ms 11380 KB Output is correct
7 Correct 1 ms 3420 KB Output is correct
8 Correct 24 ms 10632 KB Output is correct
9 Correct 27 ms 12376 KB Output is correct
10 Correct 38 ms 14596 KB Output is correct
11 Correct 2 ms 3416 KB Output is correct
12 Correct 1 ms 3416 KB Output is correct
13 Correct 1 ms 3420 KB Output is correct
14 Incorrect 37 ms 13132 KB wrong motion
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 3420 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 3420 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 3420 KB wrong motion
2 Halted 0 ms 0 KB -