Submission #95744

# Submission time Handle Problem Language Result Execution time Memory
95744 2019-02-02T08:43:02 Z dantoh000 Mechanical Doll (IOI18_doll) C++14
6 / 100
143 ms 11924 KB
#include <bits/stdc++.h>
using namespace std;
#include "doll.h"

void create_circuit(int M, std::vector<int> A) {
    int N = A.size();
    A.push_back(0);
    std::vector<int> C(M + 1);
    vector<int> nexts[M+1];
    for (int i = 0; i < N; i++){
        nexts[A[i]].push_back(A[i+1]);
    }
    int S = 0;
    for (int i = 1; i <= M; i++){
        if (nexts[i].size() == 1) continue;
        if (nexts[i].size() == 2) S++;
        //else S += 3;
    }
    C[0] = A[0];
    std::vector<int> X(S), Y(S);
    int curswitch = -1;
    for (int i = 1; i <= M; ++i) {
        //printf("%d goes to: ",i);
        //for (auto x : nexts[i]) printf("%d ",x);
        //printf("\n");
        if (nexts[i].size() == 1){
            C[i] = nexts[i][0];
        }
        else if (nexts[i].size() == 2){
            C[i] = curswitch;
            int id = -1*(curswitch--) - 1;
            X[id] = nexts[i][0];
            Y[id] = nexts[i][1];
        }
      }
    //for (auto x : C) printf("%d ",x); printf("\n");
    //for (auto x : X) printf("%d ",x); printf("\n");
    //for (auto x : Y) printf("%d ",x); printf("\n");
    answer(C, X, Y);
  }

# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 45 ms 6328 KB Output is correct
3 Correct 26 ms 5288 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 13 ms 3788 KB Output is correct
6 Correct 65 ms 7860 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 45 ms 6328 KB Output is correct
3 Correct 26 ms 5288 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 13 ms 3788 KB Output is correct
6 Correct 65 ms 7860 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 57 ms 7844 KB Output is correct
9 Correct 55 ms 9124 KB Output is correct
10 Correct 143 ms 11924 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 2 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 45 ms 6328 KB Output is correct
3 Correct 26 ms 5288 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 13 ms 3788 KB Output is correct
6 Correct 65 ms 7860 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 57 ms 7844 KB Output is correct
9 Correct 55 ms 9124 KB Output is correct
10 Correct 143 ms 11924 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 2 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Incorrect 52 ms 6264 KB wrong motion
15 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 -