# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
827777 | 2023-08-16T18:22:50 Z | AlesL0 | Mechanical Doll (IOI18_doll) | C++17 | 1000 ms | 16500 KB |
#include <bits/stdc++.h> #include "doll.h" using namespace std; int current = 1; vector <int> X, Y, C; bool check_same(vector <int> v){ for (int i = 0; i < v.size()-1; i++)if (v[i] != v[i+1])return 0; return 1; } int solve(vector <int> v){ if (check_same(v))return v[0]; vector <int> v1, v2; int c = current++; if (v.size() & 1){ v.push_back(-c); swap(v[v.size()-1], v[v.size()-2]); } for (int i = 0; i < v.size(); i+=2)v1.push_back(v[i]); for (int i = 1; i < v.size(); i+=2)v2.push_back(v[i]); int a = solve(v1), b = solve(v2); X.push_back(a); Y.push_back(b); return -c; } void create_circuit(int M, std::vector<int> A) { vector <vector <int>> dest(M+1); A.push_back(0); dest[0].push_back(A[0]); for (int i = 0; i < A.size()-1; i++)dest[A[i]].push_back(A[i+1]); C.resize(M+1); for (int i = 0; i <= M; i++){ if (dest[i].empty()){ C[i] = i; continue; } C[i] = solve(dest[i]); } for (auto x : C)cerr << x << " "; cerr << "\n"; for (int i = 0; i < X.size(); i++)cerr << X[i] << " " << Y[i] << "\n"; answer(C, X, Y); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 224 ms | 7408 KB | Output is correct |
3 | Correct | 152 ms | 5928 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 209 ms | 4344 KB | Output is correct |
6 | Correct | 230 ms | 8992 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 224 ms | 7408 KB | Output is correct |
3 | Correct | 152 ms | 5928 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 209 ms | 4344 KB | Output is correct |
6 | Correct | 230 ms | 8992 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 439 ms | 9368 KB | Output is correct |
9 | Correct | 425 ms | 10592 KB | Output is correct |
10 | Correct | 686 ms | 14684 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 1 ms | 300 KB | Output is correct |
13 | Correct | 1 ms | 304 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 224 ms | 7408 KB | Output is correct |
3 | Correct | 152 ms | 5928 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 209 ms | 4344 KB | Output is correct |
6 | Correct | 230 ms | 8992 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 439 ms | 9368 KB | Output is correct |
9 | Correct | 425 ms | 10592 KB | Output is correct |
10 | Correct | 686 ms | 14684 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 1 ms | 300 KB | Output is correct |
13 | Correct | 1 ms | 304 KB | Output is correct |
14 | Execution timed out | 1037 ms | 16500 KB | Time limit exceeded |
15 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | wrong motion |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | wrong motion |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | wrong motion |
2 | Halted | 0 ms | 0 KB | - |