# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1110145 | 2024-11-08T20:47:30 Z | StefanSebez | Mechanical Doll (IOI18_doll) | C++14 | 48 ms | 10384 KB |
#include <bits/stdc++.h> #include "doll.h" using namespace std; #define fi first #define se second #define pb push_back #define ll long long #define ld long double const int lg=18; void create_circuit(int M, std::vector<int> A){ int n=A.size();A.pb(0); vector<int>C(M+1);C[0]=A[0]; vector<int>X,Y; if(M==1){ C[1]=-1; int x=n-1; for(int i=1;i<=lg;i++){ if((x>>(lg-i))&1==1){ X.pb(1); } else X.pb(-1); Y.pb(-i-1); } Y.back()=0; } else{ /*X.resize(M),Y.resize(M); for(int i=1;i<=M;i++)C[i]=-i;*/ vector<int>vals[M+50]; for(int i=0;i<n;i++) vals[A[i]].pb(A[i+1]); for(int i=1;i<=M;i++){ if(vals[i].size()==1) C[i]=vals[i][0]; if(vals[i].size()<=1) continue; int nc=X.size()+1; C[i]=-nc; if(vals[i].size()==2){ X.pb(vals[i][0]); Y.pb(vals[i][1]); } else if(vals[i].size()==3){ X.pb(-(nc+1)); Y.pb(-(nc+2)); X.pb(vals[i][0]); Y.pb(-nc); X.pb(vals[i][1]); Y.pb(vals[i][2]); } else{ X.pb(-(nc+1)); Y.pb(-(nc+2)); X.pb(vals[i][0]); Y.pb(vals[i][2]); X.pb(vals[i][1]); Y.pb(vals[i][3]); } } } //for(auto i:C) printf("%i ",i);printf("\n"); //for(int i=0;i<X.size();i++) printf("{%i %i}\n",X[i],Y[i]); answer(C,X,Y); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 20 ms | 6196 KB | Output is correct |
3 | Correct | 18 ms | 5196 KB | Output is correct |
4 | Correct | 1 ms | 336 KB | Output is correct |
5 | Correct | 8 ms | 3920 KB | Output is correct |
6 | Correct | 25 ms | 7744 KB | Output is correct |
7 | Incorrect | 1 ms | 336 KB | Output isn't correct |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 20 ms | 6196 KB | Output is correct |
3 | Correct | 18 ms | 5196 KB | Output is correct |
4 | Correct | 1 ms | 336 KB | Output is correct |
5 | Correct | 8 ms | 3920 KB | Output is correct |
6 | Correct | 25 ms | 7744 KB | Output is correct |
7 | Incorrect | 1 ms | 336 KB | Output isn't correct |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 20 ms | 6196 KB | Output is correct |
3 | Correct | 18 ms | 5196 KB | Output is correct |
4 | Correct | 1 ms | 336 KB | Output is correct |
5 | Correct | 8 ms | 3920 KB | Output is correct |
6 | Correct | 25 ms | 7744 KB | Output is correct |
7 | Incorrect | 1 ms | 336 KB | Output isn't correct |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 336 KB | wrong motion |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 11 ms | 2896 KB | Output is correct |
3 | Correct | 11 ms | 2728 KB | Output is correct |
4 | Correct | 23 ms | 4164 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 11 ms | 2896 KB | Output is correct |
3 | Correct | 11 ms | 2728 KB | Output is correct |
4 | Correct | 23 ms | 4164 KB | Output is correct |
5 | Incorrect | 48 ms | 10384 KB | wrong motion |
6 | Halted | 0 ms | 0 KB | - |