# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
419807 | SuhaibSawalha1 | Mechanical Doll (IOI18_doll) | C++17 | 1 ms | 332 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
void create_circuit(int M, vector<int> A) {
int N = A.size();
vector<int> C(M + 1), X(1), Y(1), cnt(M + 1);
vector<vector<int>> a(3);
for (int i : A) {
++cnt[i];
}
for (int i = 1; i <= M; ++i) {
a[cnt[i]].push_back(i);
}
if (a[2].empty()) {
C[0] = -1;
X[0] = -1;
}
else {
C[0] = X[0] = a[2][0];
for (int i = 0; i < a[2].size() - 1; ++i) {
C[a[2][i]] = a[2][i + 1];
}
C[a[2].back()] = -1;
}
if (a[1].empty()) {
}
else {
Y[0] = a[1][0];
for (int i = 0; i < a[1].size() - 1; ++i) {
C[a[1][i]] = a[1][i + 1];
}
C[a[1].back()] = 0;
}
answer(C, X, Y);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |