Submission #384911

#TimeUsernameProblemLanguageResultExecution timeMemory
384911arman_ferdousMechanical Doll (IOI18_doll)C++17
6 / 100
98 ms12508 KiB
#include "doll.h" #include <bits/stdc++.h> using namespace std; #define sz(v) (int)v.size() const int M = 1e5+10; // triggers vector<int> g[M]; void create_circuit(int m, vector<int> a) { a.push_back(0); int n = a.size(); for(int i = 0; i < n - 1; i++) { g[a[i]].push_back(a[i + 1]); } vector<int> C, X, Y; C.push_back(a[0]); for(int i = 1; i <= m; i++) { assert(sz(g[i]) <= 2); if(g[i].empty()) { C.push_back(0); continue; } C.push_back(- sz(X) - 1); if(sz(g[i]) == 1) { X.push_back(- sz(Y) - 1); Y.push_back(g[i][0]); } else { X.push_back(g[i][0]); Y.push_back(g[i][1]); } } 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...