Submission #609665

#TimeUsernameProblemLanguageResultExecution timeMemory
609665MohamedAliSaidaneMechanical Doll (IOI18_doll)C++14
6 / 100
48 ms7844 KiB
#include <bits/stdc++.h> #include "doll.h" using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<pii> vpi; typedef vector<pll> vpl; #define pb push_back #define popb pop_back #define all(x) (x).begin(),(x).end() #define ff first #define ss second void create_circuit(int M, vi A) { int cnt[M + 1], seen[M + 1]; memset(cnt,0 ,sizeof(cnt)); memset(seen,0,sizeof(seen)); int N = A.size(); for(int i = 0 ; i < N; i ++) cnt[A[i]] ++; vi C(M + 1, 0), X, Y; C[0] = A[0]; for(int i = 0 ; i < N - 1; i ++) { if(cnt[A[i]] == 1) C[A[i]] = A[i + 1]; else { if(!seen[A[i]]) { X.pb(A[i + 1]); Y.pb(A[i + 1]); C[A[i]] = -X.size(); } else { Y[-C[A[i]] - 1] = A[i + 1]; } } seen[A[i]] = 1; } int i = N - 1; if(cnt[A[i]] == 1) C[A[i]] = 0; else { Y[-C[A[i]] - 1] = 0; } 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...