# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1026804 | 2024-07-18T11:31:46 Z | nisanduu | Mechanical Doll (IOI18_doll) | C++14 | 1 ms | 348 KB |
#include "doll.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; void create_circuit(int M, std::vector<int> A) { int N = A.size(); ll inf = 1e9; std::vector<int> C(M + 1,inf); map<int,int> mp; vector<int> X,Y; vector<int> unused; int sz = A.size(); int crMinus = -1; C[0] = crMinus; X.push_back(A[0]); Y.push_back(crMinus); crMinus--; vector<int> tmp = A; tmp.push_back(0); int ind = 1; for(int i=0;i<(tmp.size()-1);i++){ if(mp[tmp[i]]){ Y[mp[tmp[i]]] = tmp[i+1]; C[tmp[i]] = tmp[i+1]; }else{ C[tmp[i]] = crMinus; X.push_back(tmp[i+1]); Y.push_back(crMinus); mp[tmp[i]] = ind; ind++; crMinus--; } } for(int i=0;i<(M+1);i++){ if(C[i]==inf){ unused.push_back(i); } } sz = unused.size(); for(int i=0;i<(sz-1);i++){ C[unused[i]] = unused[i+1]; } if(sz>0){ C[unused[sz-1]] = crMinus; X.push_back(0); Y.push_back(crMinus); } //std::vector<int> X(N), Y(N); answer(C, X, Y); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | state 'Y' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | state 'Y' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | state 'Y' |
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 | 1 ms | 344 KB | wrong motion |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 344 KB | wrong motion |
2 | Halted | 0 ms | 0 KB | - |