# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1045070 | 2024-08-05T16:24:33 Z | wood | Mechanical Doll (IOI18_doll) | C++17 | 17 ms | 7448 KB |
#include "doll.h" #include <bits/stdc++.h> using namespace std; #define pb push_back void create_circuit(int M, std::vector<int> A) { int N = A.size(); std::vector<int> C(M + 1); vector<int> adj[M]; for(int i = 0; i<N; i++){ if(i<N-1) adj[A[i]-1].pb(A[i+1]); else adj[A[i]-1].pb(0); } vector<int> res(M+1), x, y; bool done[M]; memset(done,0,sizeof done); int switchcnt = 0; res[0] = A[0]; for(int i = 0; i<N; i++){ if(done[A[i]-1]) continue; done[A[i]-1] = true; if(adj[i].size()==1) res[A[i]] = adj[A[i]-1][0]; if(adj[i].size()==2){ res[A[i]] = -switchcnt-1; switchcnt++; x.pb(adj[i][0]); y.pb(adj[i][1]); } } answer(res,x,y); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Incorrect | 17 ms | 7448 KB | wrong motion |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Incorrect | 17 ms | 7448 KB | wrong motion |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Incorrect | 17 ms | 7448 KB | wrong motion |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 348 KB | wrong motion |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | wrong motion |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | wrong motion |
2 | Halted | 0 ms | 0 KB | - |