# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
139254 | 2019-07-31T13:30:33 Z | PedroBigMan | Mechanical Doll (IOI18_doll) | C++14 | 2 ms | 204 KB |
#include "doll.h" #include <iostream> #include <vector> #include <cmath> #include <algorithm> #include <string> using namespace std; typedef int ll; typedef unsigned long long int ull; typedef long double ld; #define REP(i,a,b) for(ll i=a; i<b; i++) #define pb push_back #define mp make_pair #define pl pair<ll,ll> #define ff first #define ss second #define INF ((ll) pow(2,63) -1) ll insig; #define In(vecBRO, LENBRO) REP(IBRO,0,LENBRO) {cin>>insig; vecBRO.pb(insig);} void Out(vector<ll> x) {REP(i,0,x.size()) {cout<<x[i]<<" ";} cout<<endl;} void create_circuit(int M, std::vector<int> A) { vector<ll> fol; vector<pl> sw; vector<bool> visited; REP(i,0,M+1) {fol.pb(0);visited.pb(false);} fol[0]=0; visited[0]=true; ll cur=0;ll N=A.size(); ll last=-1; REP(i,0,N) { cur = A[i]; if(!visited[cur]) { fol[cur]=0; if(i>=1) { if(last>=0) {fol[last]=cur;} else {sw[sw.size()-1].ss=cur;} } last=cur; } else if(last==cur) { sw.pb(mp(cur,0)); fol[cur]=-sw.size(); last=-sw.size(); } else { if(last>=0) {fol[last]=cur;} else {sw[sw.size()-1].ss=cur;} sw.pb(mp(fol[cur],0)); fol[cur]=-sw.size(); last=-sw.size(); } visited[cur]=true; } vector<ll> X,Y; REP(i,0,sw.size()) {X.pb(sw[i].ff); Y.pb(sw[i].ss);} answer(fol, X, Y); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | wrong motion |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | wrong motion |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | wrong motion |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 204 KB | wrong motion |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | wrong motion |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | wrong motion |
2 | Halted | 0 ms | 0 KB | - |