제출 #421527

#제출 시각아이디문제언어결과실행 시간메모리
421527Peti자동 인형 (IOI18_doll)C++14
2 / 100
116 ms13124 KiB
#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(); } 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; } 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 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...