Submission #793762

# Submission time Handle Problem Language Result Execution time Memory
793762 2023-07-26T06:22:19 Z NothingXD Mechanical Doll (IOI18_doll) C++17
6 / 100
55 ms 16548 KB
#include "doll.h"
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef double ld;
typedef complex<ld> point;

void debug_out(){cerr << endl;}
template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T){
	cerr << H << ' ';
	debug_out(T...);
}

#define debug(...) cerr << "(" << #__VA_ARGS__ << "): ", debug_out(__VA_ARGS__)
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define MP(x, y) make_pair(x, y)

const int maxn = 2e5 + 10;

int n, m, a[maxn], out[maxn], out1[maxn], out2[maxn], res;
vector<int> idx[maxn];

void solve(int v, int i, int l, int r){
	int mid = (l + r) >> 1;
	if (l + 1 == mid){
		out1[v-1] = a[idx[i][l]+1];
	}
	else{
		res++;
		out1[v-1] = -res;
		solve(res, i, l, mid);
	}
	if (mid + 1 == r){
		out2[v-1] = a[idx[i][mid]+1];
	}
	else{
		res++;
		out2[v-1] = -res;
		solve(res, i, mid, r);
	}
}

void create_circuit(int M, vector<int> A) {
	n = A.size(); m = M;
	for (int i = 0; i < n; i++){
		a[i] = A[i];
		idx[a[i]].push_back(i);
	}
	a[n] = 0;
	out[0] = a[0];
	for (int i = 1; i <= m; i++){
		int tmp = idx[i].size();
		if (tmp == 0){
			out[i] = 0;
			continue;
		}
		while(tmp % 2 == 0) tmp /= 2;
		int sz = idx[i].size() / tmp;
		if (sz == 1){
			out[i] = a[idx[i][0]+1];
			continue;
		}
		res++;
		out[i] = -res;
		solve(res, i, 0, sz);
	}
	vector<int> C(m+1), X(res), Y(res);
	for (int i = 0; i <= m; i++){
		C[i] = out[i];
	}
	for (int i = 0; i < res; i++){
		X[i] = out1[i];
		Y[i] = out2[i];
	}
	answer(C, X, Y);
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 5004 KB Output is correct
2 Correct 20 ms 9828 KB Output is correct
3 Correct 16 ms 9312 KB Output is correct
4 Correct 3 ms 4948 KB Output is correct
5 Correct 10 ms 6488 KB Output is correct
6 Correct 25 ms 11540 KB Output is correct
7 Correct 3 ms 4948 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 5004 KB Output is correct
2 Correct 20 ms 9828 KB Output is correct
3 Correct 16 ms 9312 KB Output is correct
4 Correct 3 ms 4948 KB Output is correct
5 Correct 10 ms 6488 KB Output is correct
6 Correct 25 ms 11540 KB Output is correct
7 Correct 3 ms 4948 KB Output is correct
8 Correct 35 ms 12548 KB Output is correct
9 Correct 36 ms 13120 KB Output is correct
10 Correct 55 ms 16548 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 5008 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 5004 KB Output is correct
2 Correct 20 ms 9828 KB Output is correct
3 Correct 16 ms 9312 KB Output is correct
4 Correct 3 ms 4948 KB Output is correct
5 Correct 10 ms 6488 KB Output is correct
6 Correct 25 ms 11540 KB Output is correct
7 Correct 3 ms 4948 KB Output is correct
8 Correct 35 ms 12548 KB Output is correct
9 Correct 36 ms 13120 KB Output is correct
10 Correct 55 ms 16548 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 5008 KB Output is correct
14 Incorrect 38 ms 11928 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 5008 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 5008 KB wrong motion
2 Halted 0 ms 0 KB -