Submission #130270

#TimeUsernameProblemLanguageResultExecution timeMemory
130270khulegubMechanical Doll (IOI18_doll)C++14
2 / 100
208 ms27388 KiB
#include "doll.h" #include <bits/stdc++.h> #define mp make_pair #define xx first #define yy second #define pb push_back using namespace std; typedef pair<int, int> pii; /**********************/ /* YOU ARE INVITED TO */ /* */ /* SUFFER */ /* */ /* ######## */ /* # JOIN # */ /* ######## */ /* */ /**********************/ void create_circuit(int m, vector<int> a) { a.pb(0); int n = a.size(); vector<int> c(m + 1); vector<int> x, y; // c[0] = a[0]; map<int, unordered_set<int> > garalt; garalt[0].insert( a[0] ); for (int i = 0; i < n - 1; i++){ garalt[ a[i] ].insert( a[i + 1] ); } // for (int i = 0; i < n - 1; i++){ // } int s = 0; for (auto gang : garalt){ if(gang.yy.size() == 1){ // cout << *gang.yy.begin(); c[gang.xx] = *gang.yy.begin(); } else{ int gangsz = gang.yy.size(); int gangcnt = 0; for (auto xaxa : gang.yy){ if (gangcnt == gangsz - 1){ y[s - 1] = xaxa; break; } else if (gangcnt == gangsz - 2){ x.pb(0); y.pb(0); c[gang.xx] = -(s + 1); x[s] = xaxa; s++; } else{ x.pb(0); y.pb(0); c[gang.xx] = -(s + 1); x[s] = xaxa; y[s] = -(s + 2); s++; } gangcnt++; } } // cout << gang.xx << ' ' << gang.yy.size() << '\n'; } // now we want to connect l to l + 1 // and r - 1 to r // answer(c, x, y); } // int main(){ // DRIVER - CHAN // create_circuit(9, {1, 3, 2, 1, 3, 4, 2, 1, 3}); // }
#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...