Submission #82012

# Submission time Handle Problem Language Result Execution time Memory
82012 2018-10-28T12:13:03 Z brian1266 Mechanical Doll (IOI18_doll) C++14
2 / 100
54 ms 3864 KB
#include "doll.h"
#include <stdio.h>
void create_circuit(int M, std::vector<int> A)
{
    int N = A.size();
    std::vector<int> C(M+ 1);
    std::vector<int> check(M+1);
    int mul=0;
    for(int i=0; i<N; i++)
    {
        if(check[A[i]]!=0)
            mul++;
        check[A[i]]++;
    }
    std::vector<int> X(mul), Y(mul);
    C[0] = A[0];
    int sw=-1;
    for (int i = 1; i < N; ++i)
    {
        if(check[A[i-1]]==1)
            C[A[i-1]]=A[i];
        else if(check[A[i-1]]==2)
        {
            C[A[i-1]]=sw;
            sw--;
            check[A[i-1]]=3;
            X[(-1)*sw-2]=A[i];
        }
        else
        {
            Y[(-1)*sw-2]=A[i];
        }
    }

    answer(C, X, Y);
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 26 ms 2340 KB Output is correct
3 Correct 18 ms 1740 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 16 ms 1740 KB Output is correct
6 Correct 28 ms 2616 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 26 ms 2340 KB Output is correct
3 Correct 18 ms 1740 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 16 ms 1740 KB Output is correct
6 Correct 28 ms 2616 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Incorrect 54 ms 3864 KB wrong motion
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 26 ms 2340 KB Output is correct
3 Correct 18 ms 1740 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 16 ms 1740 KB Output is correct
6 Correct 28 ms 2616 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Incorrect 54 ms 3864 KB wrong motion
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 332 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 332 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 332 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -