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"
using namespace std;
std::vector<int> X, Y;
int add_switch(){
X.push_back(0);
Y.push_back(0);
return (int)X.size()-1;
}
int add(int x, vector<int> &v){
int ret = 0;
if(v.size() == 2){
ret = add_switch();
X[ret] = v[0];
Y[ret] = v[1];
}
return -ret-1;
}
void create_circuit(int M, std::vector<int> A) {
int N = A.size();
map<int, vector<int>> kov;
kov[0].push_back(A[0]);
for(int i = 0; i < N; i++){
if(i < N-1){
kov[A[i]].push_back(A[i+1]);
} else
kov[A[i]].push_back(0);
}
std::vector<int> C(M + 1, 0);
for(auto d : kov){
//cout<<d.second.size()<<" "<<d.first<<"\n";
if(d.second.size() == 1){
C[d.first] = d.second[0];
} else
C[d.first] = add(d.first, d.second);
}
//for(int i = 0; i < M+1; i++)
//cout<<i<<" -> "<<C[i]<<"\n";
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... |