이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#ifdef NYAOWO
#include "grader.cpp"
#define OUT_VEC(x) { cout << #x << ":"; { for(auto &IT:x) cout << " " << IT; } cout << "\n"; }
#else
#define OUT_VEC(x)
#endif
#include "doll.h"
#include <bits/stdc++.h>
#define For(i, a, b) for(int i = a; i <= b; i++)
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define sz(x) ((int)x.size())
#define eb emplace_back
using namespace std;
using LL = long long;
using pii = pair<int, int>;
const int MAXM = 100010;
void create_circuit(int M, std::vector<int> A) {
vector<vector<int>> adj(M + 1, vector<int>());
vector<int> x, y;
int n = sz(A);
For(i, 0, n - 2) {
adj[A[i]].eb(A[i + 1]);
}
adj[A.back()].eb(0);
vector<int> ans(M + 1);
ans[0] = A[0];
For(i, 1, M) {
if(sz(adj[i]) == 0) {
ans[i] = 0;
} else if(sz(adj[i]) == 1) {
ans[i] = adj[i][0];
} else if(sz(adj[i]) == 2) {
int tot = sz(adj[i]);
int now = sz(x) + 1;
ans[i] = -now;
For(j, 0, tot - 3) {
x.eb(adj[i][j]);
y.eb(-(now + 1));
now++;
}
x.eb(adj[i][tot - 2]);
y.eb(adj[i][tot - 1]);
} else {
auto &v = adj[i];
int id = sz(x) + 1;
ans[i] = -id;
if(sz(adj[i]) == 4) {
x.eb(-(id + 1));
y.eb(-(id + 2));
x.eb(v[0]);
y.eb(v[2]);
x.eb(v[1]);
y.eb(v[3]);
} else {
x.eb(-(id + 1));
y.eb(-(id + 2));
x.eb(-(id));
y.eb(v[1]);
x.eb(v[0]);
y.eb(v[2]);
}
}
}
OUT_VEC(ans);
OUT_VEC(x);
OUT_VEC(y);
answer(ans, 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... |