Submission #807651

# Submission time Handle Problem Language Result Execution time Memory
807651 2023-08-04T21:08:12 Z Lobo Mechanical Doll (IOI18_doll) C++17
6 / 100
78 ms 17160 KB
#include "doll.h"
#include<bits/stdc++.h>
using namespace std;
#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define all(x) x.begin(),x.end()
#define int long long

const int inf = 1e18+10;
const int maxn = 2e5+10;

int n, m;
vector<int> g[maxn];

void create_circuit(int32_t M, std::vector<int32_t> A) {
	// int N = A.size();
	// std::vector<int> C(M + 1);
	// C[0] = -1;
	// for (int i = 1; i <= M; ++i) {
	// C[i] = 1;
	// }
	// std::vector<int> X(N), Y(N);
	// for (int k = 0; k < N; ++k) {
	// X[k] = Y[k] = A[k];
	// }
	// answer(C, X, Y);
	n = A.size();
	m = M;
	vector<int32_t> c(m+1),x,y;
	for(int i = -1; i < n; i++) {
		int u,v;
		if(i == -1) u = 0, v = A[0];
		else if(i == n-1) u = A[n-1], v = 0;
		else u = A[i], v = A[i+1];

		g[u].pb(v);
	}
	int cnt = 1;
	for(int i = 0; i <= m; i++) {
		if(g[i].size() == 0) {
			c[i] = i;
			continue;
		}
		if(g[i].size() == 1) {
			c[i] = g[i][0];
			continue;
		}

		vector<int> next = g[i]; reverse(all(next));
		vector<int> liga;
		int mult = 1;
		while(next.size() > 1) {
			vector<int> newnext;
			if(next.size()%2 == 1) {
				newnext.pb(cnt);
				x.pb(mult*next.back());
				next.pop_back();
				y.pb(0);
				liga.pb(cnt);
				cnt++;
			}
			while(next.size()) {
				newnext.pb(cnt);
				x.pb(mult*next.back());
				next.pop_back();
				y.pb(mult*next.back());
				next.pop_back();
				cnt++;
			}

			mult = -1;

			next = newnext;

		}		

		for(auto v : liga) {
			y[v] = -next[0];
		}

		c[i] = -next[0];

		// cout << i << " " << c[i] << " " << g[i].size() << endl;
	}



	answer(c,x,y);


}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4948 KB Output is correct
2 Correct 21 ms 9112 KB Output is correct
3 Correct 23 ms 8796 KB Output is correct
4 Correct 3 ms 4948 KB Output is correct
5 Correct 11 ms 6100 KB Output is correct
6 Correct 28 ms 10696 KB Output is correct
7 Correct 2 ms 4948 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4948 KB Output is correct
2 Correct 21 ms 9112 KB Output is correct
3 Correct 23 ms 8796 KB Output is correct
4 Correct 3 ms 4948 KB Output is correct
5 Correct 11 ms 6100 KB Output is correct
6 Correct 28 ms 10696 KB Output is correct
7 Correct 2 ms 4948 KB Output is correct
8 Correct 44 ms 11256 KB Output is correct
9 Correct 44 ms 11856 KB Output is correct
10 Correct 57 ms 14880 KB Output is correct
11 Correct 2 ms 4948 KB Output is correct
12 Correct 3 ms 4948 KB Output is correct
13 Correct 3 ms 5076 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4948 KB Output is correct
2 Correct 21 ms 9112 KB Output is correct
3 Correct 23 ms 8796 KB Output is correct
4 Correct 3 ms 4948 KB Output is correct
5 Correct 11 ms 6100 KB Output is correct
6 Correct 28 ms 10696 KB Output is correct
7 Correct 2 ms 4948 KB Output is correct
8 Correct 44 ms 11256 KB Output is correct
9 Correct 44 ms 11856 KB Output is correct
10 Correct 57 ms 14880 KB Output is correct
11 Correct 2 ms 4948 KB Output is correct
12 Correct 3 ms 4948 KB Output is correct
13 Correct 3 ms 5076 KB Output is correct
14 Incorrect 78 ms 17160 KB wrong motion
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 4948 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 4948 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 4948 KB wrong motion
2 Halted 0 ms 0 KB -