제출 #297257

#제출 시각아이디문제언어결과실행 시간메모리
297257eohomegrownapps자동 인형 (IOI18_doll)C++14
6 / 100
98 ms12328 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...