Submission #1041564

# Submission time Handle Problem Language Result Execution time Memory
1041564 2024-08-02T05:51:05 Z yanb Mechanical Doll (IOI18_doll) C++14
0 / 100
1 ms 348 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, Y;
	int nots = 0;
	C[0] = g[0][0];
	for (int i = 1; i < k + 1; i++) {
		nots += 3;
		C[i] = -nots + 2;
		X.push_back(-nots + 1);
		Y.push_back(-nots);
		vector<int> outs(4, -nots + 2);
		for (int j = 4 - g[i].size(); j < 4; j++) {
			outs[j] = g[i][j - (4 - g[i].size())];
		}
		X.push_back(outs[0]);
		Y.push_back(outs[2]);
		X.push_back(outs[1]);
		Y.push_back(outs[3]);
	}

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

	answer(C, X, Y);
}

#ifdef LOCAL
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});
}
#endif
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 348 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 348 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -