이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "doll.h"
#include "bits/stdc++.h"
using namespace std;
void create_circuit(int M, vector<int> A){
int n = A.size();
map<int, int> Mapa;
bool _1 = 1, _2 = 1;
for(int i = 0; i < n; i++){
Mapa[A[i]]++;
if(Mapa[A[i]] > 1) _1 = 0;
if(Mapa[A[i]] > 2) _2 = 0;
}
vector<int> c(M + 1, 0), x, y;
if(M == 1){
if(n == 1) c = {1, 0};
else {
c = {1, -1};
int j = -1;
for(int i = 0; i < n - 1; i++){
if(j + 1 == 0) x.push_back(1);
else x.push_back(j + 1);
y.push_back(j - 1);
j--;
}
y.back() = 0;
}
} else if(_1){
for(int i = 0; i < n; i++){
if(i == 0){
c[0] = A[i];
} else {
c[A[i - 1]] = A[i];
}
}
} else if(_2){
vector<bool> Usados(M + 1, 0);
int j = -1;
A.push_back(0);
for(int i = 0; i <= n; i++){
if(i == 0){
c[0] = A[i];
} else {
if(Usados[A[i - 1]]){
x.push_back(c[A[i - 1]]);
c[A[i - 1]] = j;
j--;
y.push_back(A[i]);
} else {
c[A[i - 1]] = A[i];
Usados[A[i - 1]] = 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... |