Submission #1068176

# Submission time Handle Problem Language Result Execution time Memory
1068176 2024-08-21T08:17:40 Z UmairAhmadMirza Mechanical Doll (IOI18_doll) C++17
6 / 100
49 ms 14788 KB
#include <bits/stdc++.h>
using namespace std;
void answer(vector<int> C, vector<int> X, vector<int> Y);

int const MAXN=2e5+5;
vector<int> nxt[MAXN];

void create_circuit(int m, vector<int> A){
	int n=A.size();
	vector<int> C(m+1);
	vector<int> X,Y;
	C[0]=A[0];
	for(int i=1;i<n;i++)
		nxt[A[i-1]].push_back(A[i]);
	nxt[A[n-1]].push_back(0);
	int s=0;
	for(int i=1;i<=m;i++){
		int sz=nxt[i].size();
		if(sz==0)
			C[i]=0;
		else if(sz==1)
			C[i]=nxt[i][0];
		else if(sz==2){
			s++;
			C[i]=-s;
			X.push_back(nxt[i][0]);
			Y.push_back(nxt[i][1]);
		}
		else if(sz==3){
			s++;
			C[i]=-s;
			X.push_back(-(s+1));
			Y.push_back(-(s+2));
			X.push_back(nxt[i][0]);
			Y.push_back(-s);
			X.push_back(nxt[i][1]);
			X.push_back(nxt[i][2]);
			s+=2;
		}
		else{
			s++;
			C[i]=-s;
			X.push_back(-(s+1));
			Y.push_back(-(s+2));
			X.push_back(nxt[i][0]);
			Y.push_back(nxt[i][2]);
			X.push_back(nxt[i][1]);
			X.push_back(nxt[i][3]);
			s+=2;
		}
	}
	answer(C,X,Y);
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4952 KB Output is correct
2 Correct 17 ms 9308 KB Output is correct
3 Correct 14 ms 8796 KB Output is correct
4 Correct 3 ms 4956 KB Output is correct
5 Correct 7 ms 6156 KB Output is correct
6 Correct 21 ms 10732 KB Output is correct
7 Correct 2 ms 4952 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4952 KB Output is correct
2 Correct 17 ms 9308 KB Output is correct
3 Correct 14 ms 8796 KB Output is correct
4 Correct 3 ms 4956 KB Output is correct
5 Correct 7 ms 6156 KB Output is correct
6 Correct 21 ms 10732 KB Output is correct
7 Correct 2 ms 4952 KB Output is correct
8 Correct 39 ms 11480 KB Output is correct
9 Correct 30 ms 11992 KB Output is correct
10 Correct 49 ms 14788 KB Output is correct
11 Correct 2 ms 4952 KB Output is correct
12 Correct 3 ms 4956 KB Output is correct
13 Correct 2 ms 4956 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4952 KB Output is correct
2 Correct 17 ms 9308 KB Output is correct
3 Correct 14 ms 8796 KB Output is correct
4 Correct 3 ms 4956 KB Output is correct
5 Correct 7 ms 6156 KB Output is correct
6 Correct 21 ms 10732 KB Output is correct
7 Correct 2 ms 4952 KB Output is correct
8 Correct 39 ms 11480 KB Output is correct
9 Correct 30 ms 11992 KB Output is correct
10 Correct 49 ms 14788 KB Output is correct
11 Correct 2 ms 4952 KB Output is correct
12 Correct 3 ms 4956 KB Output is correct
13 Correct 2 ms 4956 KB Output is correct
14 Incorrect 29 ms 13964 KB Wrong Answer: wrong array length
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 4956 KB Wrong Answer: wrong array length
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 4952 KB Wrong Answer: wrong array length
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 4952 KB Wrong Answer: wrong array length
2 Halted 0 ms 0 KB -