# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1068208 | 2024-08-21T08:33:27 Z | Sir_Ahmed_Imran | Mechanical Doll (IOI18_doll) | C++17 | 0 ms | 0 KB |
///~~~LOTA~~~/// #include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define append push_back #define add insert #define nl '\n' #define ff first #define ss second #define pii pair<int,int> #define pll pair<ll,ll> #define all(x) (x).begin(),(x).end() #define L0TA ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) #define terminator main #define N 100001 vector<int> p[N]; void create_circuit(int m,vector<int> a){ vector<int> c,x,y; c.append(a[0]); a.append(0); int o=-1; for(int i=0;i<a.size();i++) p[a[i]].append(i+1); for(int i=1;i<=m;i++){ c.append(0); if(p[i].size()==1) c[i]=a[p[i][0]]; if(p[i].size()>1){ c[i]=o; o--; x.append(a[p[i][0]]); y.append(a[p[i][1]]); } } answer(c,x,y); }