Submission #972784

#TimeUsernameProblemLanguageResultExecution timeMemory
972784kwongwengMechanical Doll (IOI18_doll)C++17
16 / 100
61 ms12232 KiB
#include "doll.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> ii; typedef vector<ii> vii; typedef long double ld; typedef vector<vector<ll>> vll; #define FOR(i, a, b) for(int i = a; i < b; i++) #define ROF(i, a, b) for(int i = a; i >= b; i--) #define pb push_back #define ms memset #define fi first #define se second void create_circuit(int M, vi A) { int N = A.size(); vi C(M + 1); C[0] = A[0]; vi nxt[M+1]; FOR(i,0,N-1){ nxt[A[i]].pb(A[i+1]); } nxt[A[N-1]].pb(0); int cur = 1; vi X,Y; FOR(i,1,M+1){ if (nxt[i].size()==1) C[i] = nxt[i][0]; if (nxt[i].size()==2){ C[i] = -cur; cur++; X.pb(nxt[i][0]); Y.pb(nxt[i][1]); } if (nxt[i].size()==3){ C[i] = -cur; X.pb(-cur-1); Y.pb(-cur-2); X.pb(nxt[i][0]); Y.pb(-cur); X.pb(nxt[i][1]); Y.pb(nxt[i][2]); cur += 3; } if (nxt[i].size()==4){ C[i] = -cur; X.pb(-cur-1); Y.pb(-cur-2); X.pb(nxt[i][0]); Y.pb(nxt[i][2]); X.pb(nxt[i][1]); Y.pb(nxt[i][3]); cur+=3; } } 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...