# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
999337 | 2024-06-15T10:15:08 Z | MarwenElarbi | Mechanical Doll (IOI18_doll) | C++17 | 54 ms | 15092 KB |
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define ll long long #define pb push_back #define ii pair<int,int> const int nax=2e5+5; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); vector<int> adj[nax]; int vis[nax]; int counter=0; void answer(std::vector<int> C, std::vector<int> X, std::vector<int> Y); void create_circuit(int M, std::vector<int> A) { vector<int> X,Y; vector<int> C(M+1); C[0]=A[0]; int N = A.size(); A.pb(0); for (int i = 0; i < N; ++i) { adj[A[i]].pb(A[i+1]); } for (int i = 0; i < N; ++i) { if(vis[A[i]]>0) continue; vis[A[i]]=1; if(adj[A[i]].size()==1){ C[A[i]]=A[i+1]; continue; } X.emplace_back(); Y.emplace_back(); C[A[i]]=-(int)(X.size()); for (int j = 0; j < adj[A[i]].size()-2; ++j) { //cout <<A[i]<<" "<<j<<endl; X.back()=adj[A[i]][j]; Y.back()=-((int)X.size()+1); X.emplace_back(); Y.emplace_back(); } X.back()=adj[A[i]][adj[A[i]].size()-2]; Y.back()=adj[A[i]][adj[A[i]].size()-1]; } /*for (int i = 0; i < M+1; ++i) { cout << C[i]<<" "; }cout <<endl; for (int i = 0; i < X.size(); ++i) { cout <<X[i]<<" "; }cout <<endl; for (int i = 0; i < Y.size(); ++i) { cout <<Y[i]<<" "; }cout <<endl;*/ answer(C, X, Y); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 5724 KB | Output is correct |
2 | Correct | 15 ms | 9560 KB | Output is correct |
3 | Correct | 15 ms | 9048 KB | Output is correct |
4 | Correct | 1 ms | 5724 KB | Output is correct |
5 | Correct | 6 ms | 6748 KB | Output is correct |
6 | Correct | 19 ms | 10964 KB | Output is correct |
7 | Correct | 1 ms | 5720 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 5724 KB | Output is correct |
2 | Correct | 15 ms | 9560 KB | Output is correct |
3 | Correct | 15 ms | 9048 KB | Output is correct |
4 | Correct | 1 ms | 5724 KB | Output is correct |
5 | Correct | 6 ms | 6748 KB | Output is correct |
6 | Correct | 19 ms | 10964 KB | Output is correct |
7 | Correct | 1 ms | 5720 KB | Output is correct |
8 | Correct | 34 ms | 11588 KB | Output is correct |
9 | Correct | 39 ms | 11968 KB | Output is correct |
10 | Correct | 43 ms | 15092 KB | Output is correct |
11 | Correct | 1 ms | 5724 KB | Output is correct |
12 | Correct | 1 ms | 5724 KB | Output is correct |
13 | Correct | 2 ms | 5724 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 5724 KB | Output is correct |
2 | Correct | 15 ms | 9560 KB | Output is correct |
3 | Correct | 15 ms | 9048 KB | Output is correct |
4 | Correct | 1 ms | 5724 KB | Output is correct |
5 | Correct | 6 ms | 6748 KB | Output is correct |
6 | Correct | 19 ms | 10964 KB | Output is correct |
7 | Correct | 1 ms | 5720 KB | Output is correct |
8 | Correct | 34 ms | 11588 KB | Output is correct |
9 | Correct | 39 ms | 11968 KB | Output is correct |
10 | Correct | 43 ms | 15092 KB | Output is correct |
11 | Correct | 1 ms | 5724 KB | Output is correct |
12 | Correct | 1 ms | 5724 KB | Output is correct |
13 | Correct | 2 ms | 5724 KB | Output is correct |
14 | Incorrect | 54 ms | 13472 KB | wrong motion |
15 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 5724 KB | wrong motion |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 5724 KB | wrong motion |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 5724 KB | wrong motion |
2 | Halted | 0 ms | 0 KB | - |