제출 #1211378

#제출 시각아이디문제언어결과실행 시간메모리
1211378SpyrosAliv자동 인형 (IOI18_doll)C++20
6 / 100
47 ms11196 KiB
#include "doll.h" #include <bits/stdc++.h> using namespace std; void create_circuit(int m, vector<int> a) { int n = a.size(); vector<vector<int>> after(m+1); after[0].push_back(a[0]); for (int i = 0; i < n-1; i++) { after[a[i]].push_back({a[i+1]}); } after[a.back()].push_back(0); vector<int> conn(m+1); for (int i = 0; i <= m; i++) conn[i] = i; vector<int> x, y; int sw = 0; for (int i = 0; i <= m; i++) { int adj = after[i].size(); if (adj == 0) continue; else if (adj == 1) { conn[i] = after[i][0]; continue; } else if (adj == 2) { sw++; x.push_back(after[i][0]); y.push_back(after[i][1]); conn[i] = -sw; } else if (adj == 3) { sw++; x.push_back(sw+1); y.push_back(sw+2); conn[i] = sw; sw++; x.push_back(after[i][0]); y.push_back(sw - 1); sw++; x.push_back(after[i][1]); y.push_back(after[i][2]); } else if (adj == 4) { sw++; x.push_back(sw+1); y.push_back(sw+2); conn[i] = sw; sw++; x.push_back(after[i][0]); y.push_back(after[i][2]); sw++; x.push_back(after[i][1]); y.push_back(after[i][3]); } } answer(conn, 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...