제출 #333696

#제출 시각아이디문제언어결과실행 시간메모리
333696nicholask자동 인형 (IOI18_doll)C++14
0 / 100
1 ms204 KiB
#include "doll.h" #include <bits/stdc++.h> using namespace std; void create_circuit(int m,vector <int> a){ int n=a.size(); vector <int> nxt[m+1]; a.push_back(0); for (int i=0; i<n; i++){ nxt[a[i]].push_back(a[i+1]); } bool ok=1; for (int i=1; i<=m; i++){ if (nxt[i].size()>4){ ok=0; break; } } vector <int> c,x,y; int cur=0; if (ok){ c.push_back(a[0]); map <int,int> p; for (int i=1; i<=n; i++){ if (nxt[a[i-1]].size()==1){ c.push_back(a[i]); } else if (nxt[a[i-1]].size()==2){ if (p.count(a[i-1])) c.push_back(p[a[i-1]]); else { cur--; p[a[i-1]]=cur; c.push_back(cur); x.push_back(nxt[a[i]][0]); y.push_back(nxt[a[i]][1]); } } //else if (nxt[a[i-1]].size()==3){ //} else if (nxt[a[i-1]].size()==4){ //} } } answer(c,x,y); return; }
#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...