이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> adjlist;
vector<int> exitto;
vector<int> switchxto;
vector<int> switchyto;
int sind = 0;
int create(int trigger, int s, int e){
//cout<<"create "<<trigger<<' '<<s<<' '<<e<<endl;
if (s==e){
//cout<<"ret "<<adjlist[trigger][s]<<'\n';
return adjlist[trigger][s];
}
int switchtouse = sind;
switchxto.push_back(-1e9);
switchyto.push_back(-1e9);
sind++;
int m = (s+e)/2;
//cout<<"update "<<switchtouse<<'\n';
int cl = create(trigger,s,m);
int cr = create(trigger,m+1,e);
switchxto[switchtouse]=cl;
switchyto[switchtouse]=cr;
//cout<<"==== "<<switchxto[switchtouse]<<' '<<switchyto[switchtouse]<<'\n';
//cout<<"ret "<<-1-switchtouse<<'\n';
return -1-switchtouse;
}
void processSwitches(int trigger){
if (adjlist[trigger].size()==0){return;}
exitto[trigger]=create(trigger,0,adjlist[trigger].size()-1);
}
void create_circuit(int m, std::vector<int> a) {
int n = a.size();
adjlist.resize(m+1);
a.push_back(0);
for (int i = 0; i<n; i++){
adjlist[a[i]].push_back(a[i+1]);
}
exitto.resize(m+1);
exitto[0]=a[0];
for (int i = 1; i<=m; i++){
//cout<<"process "<<i<<endl;
processSwitches(i);
}
//for (int i : exitto){
//cout<<i<<' ';
//}//cout<<'\n';
//for (int i : switchxto){
//cout<<i<<' ';
//}//cout<<'\n';
//for (int i : switchyto){
//cout<<i<<' ';
//}//cout<<'\n';
//cout<<"answer:\n";
answer(exitto,switchxto,switchyto);
}
# | 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... |