Submission #862701

# Submission time Handle Problem Language Result Execution time Memory
862701 2023-10-18T22:14:06 Z IBory Mechanical Doll (IOI18_doll) C++17
2 / 100
21 ms 8268 KB
#include "doll.h"
#include <bits/stdc++.h>
using namespace std;

const int MAX = 100007;
vector<int> occur[MAX];
int cn[MAX];

void create_circuit(int M, vector<int> A) {
	int N = A.size();
	for (int i = 0; i < N; ++i) occur[A[i]].push_back(i);
	A.push_back(0);
	occur[0].push_back(0);

	vector<int> C, X, Y;
	C.resize(M + 1);
	int pv = 0, sn = 0;
	for (int i = 0; i < A.size(); ++i) {
		if (occur[pv].size() == 1) C[pv] = A[i];
		else {
			if (C[pv] < 0) continue;
			C[pv] = --sn;
			X.push_back(A[occur[pv][cn[pv]++] + 1]);
			Y.push_back(A[occur[pv][cn[pv]++] + 1]);
		}
		pv = A[i];
	}

	answer(C, X, Y);
}

Compilation message

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:18:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |  for (int i = 0; i < A.size(); ++i) {
      |                  ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2904 KB Output is correct
2 Correct 18 ms 6744 KB Output is correct
3 Correct 15 ms 6232 KB Output is correct
4 Correct 1 ms 2908 KB Output is correct
5 Correct 8 ms 4068 KB Output is correct
6 Correct 21 ms 8268 KB Output is correct
7 Correct 1 ms 2904 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2904 KB Output is correct
2 Correct 18 ms 6744 KB Output is correct
3 Correct 15 ms 6232 KB Output is correct
4 Correct 1 ms 2908 KB Output is correct
5 Correct 8 ms 4068 KB Output is correct
6 Correct 21 ms 8268 KB Output is correct
7 Correct 1 ms 2904 KB Output is correct
8 Incorrect 21 ms 6996 KB wrong motion
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2904 KB Output is correct
2 Correct 18 ms 6744 KB Output is correct
3 Correct 15 ms 6232 KB Output is correct
4 Correct 1 ms 2908 KB Output is correct
5 Correct 8 ms 4068 KB Output is correct
6 Correct 21 ms 8268 KB Output is correct
7 Correct 1 ms 2904 KB Output is correct
8 Incorrect 21 ms 6996 KB wrong motion
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2908 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2908 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2908 KB wrong motion
2 Halted 0 ms 0 KB -