이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100100;
const int INF = 123456;
int app[MAXN];
bool secondTime[MAXN];
void printAns(vector<int> C, vector<int> X, vector<int> Y) {
cout << "C: ";
for (int x : C)
cout << x << " ";
cout << endl;
cout << "(X, Y): ";
for (int i = 0; i < (int)X.size(); i++) {
cout << "(" << X[i] << ", "
<< Y[i] << ") ";
}
cout << endl;
}
void create_circuit(int M, std::vector<int> A) {
A.push_back(0);
int reqTrig = A.size();
memset(app, 0, sizeof(app));
memset(secondTime, false, sizeof(secondTime));
vector<int> C(M + 1, INF);
vector<int> X, Y;
for (int x : A)
app[x]++;
int sCount = -1;
C[0] = A[0];
for (int i = 0; i < reqTrig-1; i++) {
int now = A[i];
int nex = A[i+1];
if (secondTime[now]) {
Y[-C[now]-1] = nex;
} else if (app[A[i]] == 2) {
C[now] = sCount;
sCount -= 1;
X.push_back(nex);
Y.push_back(-1);
} else {
C[now] = nex;
}
secondTime[now] = true;
}
for (int i = 1; i <= M; i++) {
if (C[i] == INF)
C[i] = 0;
}
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... |