Submission #124447

# Submission time Handle Problem Language Result Execution time Memory
124447 2019-07-03T10:53:19 Z anayk Mechanical Doll (IOI18_doll) C++14
0 / 100
2 ms 204 KB
#include "doll.h"
#include <iostream>

#define MAXN 200005

std::vector<int> x;
std::vector<int> y;

int make(std::vector<int> sam)
{
    if(sam.size() == 1)
        return sam[0];

    std::vector<int> sam1;
    std::vector<int> sam2;
    for(int i = 0; i < sam.size(); i++)
    {
        if(i % 2)
            sam2.push_back(sam[i]);
        else
            sam1.push_back(sam[i]);
    }

    int a = make(sam1);
    int b = make(sam2);

    x.push_back(a);
    y.push_back(b);

    return -x.size();
}

void create_circuit(int M, std::vector<int> A)
{
    int root = make(A);

    std::vector<int> c(M+1);
    for(int i = 0; i <= M; i++)
        c[i] = root;
    
    c[A[A.size() - 1]] = 0;
    
    answer(c, x, y);
}

Compilation message

doll.cpp: In function 'int make(std::vector<int>)':
doll.cpp:16:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |     for(int i = 0; i < sam.size(); i++)
      |                    ~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 204 KB state 'Y'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 204 KB state 'Y'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 204 KB state 'Y'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB wrong motion
3 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 2 ms 204 KB wrong motion
2 Halted 0 ms 0 KB -