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;
#define sz(v) (int)v.size()
const int M = 1e5+10; // triggers
vector<int> g[M];
void create_circuit(int m, vector<int> a) {
a.push_back(0);
int n = a.size();
for(int i = 0; i < n - 1; i++) {
g[a[i]].push_back(a[i + 1]);
}
vector<int> C, X, Y; C.push_back(a[0]);
for(int i = 1; i <= m; i++) {
assert(sz(g[i]) <= 2);
if(g[i].empty()) {
C.push_back(0);
continue;
}
C.push_back(- sz(X) - 1);
if(sz(g[i]) == 1) {
X.push_back(- sz(Y) - 1);
Y.push_back(g[i][0]);
}
else {
X.push_back(g[i][0]);
Y.push_back(g[i][1]);
}
}
answer(C, X, Y);
}
# | 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... |