# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
94980 | someone_aa | Mechanical Doll (IOI18_doll) | C++17 | 93 ms | 10972 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 <bits/stdc++.h>
#include "doll.h"
#define pb push_back
#define mp make_pair
using namespace std;
const int maxm = 100100;
vector<int> after[maxm];
void create_circuit(int M, std::vector<int> A) {
int N = A.size();
std::vector<int> C(M + 1, 0);
C[0] = A[0];
for(int i=1;i<A.size();i++) {
after[A[i-1]].pb(A[i]);
}
after[A.back()].pb(0);
vector<int> X, Y;
int br = 1;
for(int i=1;i<=M;i++) {
if(after[i].size() == 0) continue;
else if(after[i].size() == 1) {
C[i] = after[i][0];
}
else {
C[i] = -br;
X.pb(after[i][0]);
Y.pb(after[i][1]);
br++;
}
}
/*for (int k = 0; k < N; ++k) {
X[k] = Y[k] = A[k];
}*/
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... |