# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
766077 | 2023-06-25T09:52:10 Z | ono_de206 | Mechanical Doll (IOI18_doll) | C++14 | 69 ms | 11232 KB |
#include "doll.h" #include<bits/stdc++.h> using namespace std; #define in insert #define all(x) x.begin(),x.end() #define pb push_back #define eb emplace_back #define ff first #define ss second // #define int long long typedef long long ll; typedef vector<int> vi; typedef set<int> si; typedef multiset<int> msi; typedef pair<int, int> pii; typedef vector<pii> vpii; void create_circuit(int m, std::vector<int> a) { int n = a.size(); a.pb(0); vector<int> C(m + 1, 0), X, Y; vector<vector<int>> nx(m + 1); nx[0].pb(a[0]); for(int i = 0; i < n; i++) { nx[a[i]].pb(a[i + 1]); } int now = 0, root; function<int(vector<int>&)> solve = [&](vector<int>& vec) { if(vec.size() == 2) { X.pb(vec[0]); Y.pb(vec[1]); } else { vector<int> first, second; for(int i = 0; i < (int)vec.size(); i += 2) { first.pb(vec[i]); second.pb(vec[i + 1]); } X.pb(solve(first)); Y.pb(solve(second)); } now++; return -now; }; for(int i = 0; i <= m; i++) { if(nx[i].size() == 0) continue; if(nx[i].size() == 1) { C[i] = nx[i][0]; continue; } int nxt = 1; while(nxt * 2 < nx[i].size()) nxt *= 2; reverse(all(nx[i])); while(nx[i].size() < nxt * 2) nx[i].pb(i); reverse(all(nx[i])); C[i] = solve(nx[i]); } answer(C, X, Y); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 19 ms | 6352 KB | Output is correct |
3 | Correct | 16 ms | 5120 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 11 ms | 3816 KB | Output is correct |
6 | Correct | 23 ms | 7736 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 19 ms | 6352 KB | Output is correct |
3 | Correct | 16 ms | 5120 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 11 ms | 3816 KB | Output is correct |
6 | Correct | 23 ms | 7736 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 33 ms | 7248 KB | Output is correct |
9 | Correct | 35 ms | 8528 KB | Output is correct |
10 | Correct | 50 ms | 11232 KB | Output is correct |
11 | Correct | 0 ms | 212 KB | Output is correct |
12 | Correct | 0 ms | 212 KB | Output is correct |
13 | Correct | 1 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 19 ms | 6352 KB | Output is correct |
3 | Correct | 16 ms | 5120 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 11 ms | 3816 KB | Output is correct |
6 | Correct | 23 ms | 7736 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 33 ms | 7248 KB | Output is correct |
9 | Correct | 35 ms | 8528 KB | Output is correct |
10 | Correct | 50 ms | 11232 KB | Output is correct |
11 | Correct | 0 ms | 212 KB | Output is correct |
12 | Correct | 0 ms | 212 KB | Output is correct |
13 | Correct | 1 ms | 212 KB | Output is correct |
14 | Incorrect | 69 ms | 10948 KB | wrong motion |
15 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | wrong motion |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | wrong motion |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | wrong motion |
2 | Halted | 0 ms | 0 KB | - |