Submission #198147

#TimeUsernameProblemLanguageResultExecution timeMemory
198147SuperJavaMechanical Doll (IOI18_doll)C++17
16 / 100
109 ms14060 KiB
#include "doll.h" #include <vector> #define sz(A) int(size(A)) using namespace std; vector<int> adj[200005]; void create_circuit(int M, vector<int> A) { for(int i = 0; i < sz(A)-1; i++){ adj[A[i]].push_back(A[i+1]); } adj[A[sz(A)-1]].push_back(0); vector<int> C(M+1); C[0] = A[0]; vector<int> X,Y; for(int i = 1; i <= M; i++){ if(sz(adj[i]) == 0) continue; if(sz(adj[i]) == 1){ C[i] = adj[i][0]; continue; } if(sz(adj[i]) == 2){ C[i] = -(sz(X)+1); X.push_back(adj[i][0]); Y.push_back(adj[i][1]); continue; } if(sz(adj[i]) == 3){ int fir = -(sz(X)+1), sec = -(sz(X)+2), thi = -(sz(X)+3); C[i] = fir; X.push_back(sec); Y.push_back(thi); X.push_back(adj[i][0]); Y.push_back(fir); X.push_back(adj[i][1]); Y.push_back(adj[i][2]); continue; } if(sz(adj[i]) == 4){ int fir = -(sz(X)+1), sec = -(sz(X)+2), thi = -(sz(X)+3); C[i] = fir; X.push_back(sec); Y.push_back(thi); X.push_back(adj[i][0]); Y.push_back(adj[i][2]); X.push_back(adj[i][1]); Y.push_back(adj[i][3]); continue; } } 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...