# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
642865 | 2022-09-20T16:52:08 Z | ghostwriter | Mechanical Doll (IOI18_doll) | C++14 | 84 ms | 14264 KB |
#include "doll.h" #include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include <debug.h> #include "grader.cpp" #endif #define st first #define nd second #define pb push_back #define pf push_front #define _pb pop_back #define _pf pop_front #define lb lower_bound #define ub upper_bound #define mtp make_tuple #define all(x) (x).begin(), (x).end() #define sz(x) (int)(x).size() typedef long long ll; typedef unsigned long long ull; typedef double db; typedef long double ldb; typedef pair<int, int> pi; typedef pair<ll, ll> pll; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<pi> vpi; typedef vector<pll> vpll; typedef string str; template<typename T> T gcd(T a, T b) { return (b == 0? a : gcd(b, a % b)); } template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; } #define FOR(i, l, r) for (int (i) = (l); (i) <= (r); ++(i)) #define FOS(i, r, l) for (int (i) = (r); (i) >= (l); --(i)) #define EACH(i, x) for (auto &(i) : (x)) #define WHILE while #define file "TEST" mt19937 rd(chrono::steady_clock::now().time_since_epoch().count()); ll rand(ll l, ll r) { return uniform_int_distribution<ll>(l, r)(rd); } /* Tran The Bao CTL - Da Lat Cay ngay cay dem nhung deo duoc cong nhan */ const int MAXM = 1e5 + 5; int d[MAXM]; namespace subtask123 { vi next[MAXM]; void create_circuit(int M, vi A) { vi C(M + 1, 0), X, Y; int N = sz(A); next[0].pb(A[0]); FOR(i, 0, N - 1) next[A[i]].pb(i == N - 1? 0 : A[i + 1]); int S = 0; FOR(i, 0, M) { if (next[i].empty()) { C[i] = 0; continue; } if (sz(next[i]) == 1) { C[i] = next[i][0]; continue; } if (sz(next[i]) == 2) { C[i] = --S; X.pb(next[i][0]); Y.pb(next[i][1]); continue; } if (sz(next[i]) == 3) { C[i] = --S; X.pb(S - 1); Y.pb(S - 2); --S; X.pb(next[i][0]); Y.pb(next[i][1]); --S; X.pb(S + 2); Y.pb(next[i][2]); continue; } C[i] = --S; X.pb(S - 1); Y.pb(S - 2); --S; X.pb(next[i][0]); Y.pb(next[i][2]); --S; X.pb(next[i][1]); Y.pb(next[i][3]); } answer(C, X, Y); } } void create_circuit(int M, std::vector<int> A) { int N = A.size(); bool sub123 = 1; FOR(i, 0, N - 1) { ++d[A[i]]; if (d[A[i]] > 4) sub123 = 0; } if (sub123) { subtask123::create_circuit(M, A); return; } } /* 4 4 1 2 1 3 */
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2644 KB | Output is correct |
2 | Correct | 25 ms | 7508 KB | Output is correct |
3 | Correct | 20 ms | 6996 KB | Output is correct |
4 | Correct | 1 ms | 2644 KB | Output is correct |
5 | Correct | 9 ms | 3796 KB | Output is correct |
6 | Correct | 32 ms | 9172 KB | Output is correct |
7 | Correct | 2 ms | 2772 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2644 KB | Output is correct |
2 | Correct | 25 ms | 7508 KB | Output is correct |
3 | Correct | 20 ms | 6996 KB | Output is correct |
4 | Correct | 1 ms | 2644 KB | Output is correct |
5 | Correct | 9 ms | 3796 KB | Output is correct |
6 | Correct | 32 ms | 9172 KB | Output is correct |
7 | Correct | 2 ms | 2772 KB | Output is correct |
8 | Correct | 42 ms | 9672 KB | Output is correct |
9 | Correct | 43 ms | 10440 KB | Output is correct |
10 | Correct | 67 ms | 13668 KB | Output is correct |
11 | Correct | 2 ms | 2652 KB | Output is correct |
12 | Correct | 2 ms | 2644 KB | Output is correct |
13 | Correct | 2 ms | 2644 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2644 KB | Output is correct |
2 | Correct | 25 ms | 7508 KB | Output is correct |
3 | Correct | 20 ms | 6996 KB | Output is correct |
4 | Correct | 1 ms | 2644 KB | Output is correct |
5 | Correct | 9 ms | 3796 KB | Output is correct |
6 | Correct | 32 ms | 9172 KB | Output is correct |
7 | Correct | 2 ms | 2772 KB | Output is correct |
8 | Correct | 42 ms | 9672 KB | Output is correct |
9 | Correct | 43 ms | 10440 KB | Output is correct |
10 | Correct | 67 ms | 13668 KB | Output is correct |
11 | Correct | 2 ms | 2652 KB | Output is correct |
12 | Correct | 2 ms | 2644 KB | Output is correct |
13 | Correct | 2 ms | 2644 KB | Output is correct |
14 | Correct | 84 ms | 14264 KB | Output is correct |
15 | Correct | 43 ms | 8904 KB | Output is correct |
16 | Correct | 68 ms | 12360 KB | Output is correct |
17 | Correct | 2 ms | 2644 KB | Output is correct |
18 | Correct | 2 ms | 2668 KB | Output is correct |
19 | Correct | 2 ms | 2644 KB | Output is correct |
20 | Correct | 77 ms | 13652 KB | Output is correct |
21 | Correct | 2 ms | 2644 KB | Output is correct |
22 | Correct | 1 ms | 2644 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 2644 KB | Wrong Answer: answered not exactly once |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 2668 KB | Wrong Answer: answered not exactly once |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 2668 KB | Wrong Answer: answered not exactly once |
2 | Halted | 0 ms | 0 KB | - |