Submission #829480

# Submission time Handle Problem Language Result Execution time Memory
829480 2023-08-18T11:13:08 Z vnm06 Mechanical Doll (IOI18_doll) C++14
9 / 100
62 ms 12316 KB
#include<bits/stdc++.h>
#include "doll.h"
using namespace std;

bool st2(int n)
{
    return n==(n&(-n));
}

vector<int> C;
vector<int> posl;
vector<int> posl2;

void create_circuit(int M, std::vector<int> A)
{
    int N = A.size();
    while(!st2(N+1))
    {
        N++;
        A.push_back(-1);
    }
    A.push_back(0);
    C.resize(M+1);
    for (int i = 0; i <= M; ++i) C[i]=-1;
    std::vector<int> X(N), Y(N);
    for (int k = 1; k <= N/2; k++)
    {
        X[k-1]=-2*k;
        Y[k-1]=-2*k-1;
    }
    int rm=1, le=1, ri=1;
    posl.push_back(A[0]);
    while(rm!=N+1)
    {
        rm*=2;
        posl2.resize(rm);
        for(int i=0; i<rm; i++)
        {
            if(i%2==0) posl2[i]=posl[i/2];
            else posl2[i]=A[le+i/2];
        }
        le=ri+1;
        ri=le*2-1;
        posl=posl2;
       /// for(int i=0; i<posl.size(); i++) cout<<posl[i]<<" ";
       /// cout<<endl;
    }
    for (int k = N/2+1; k <=N; k++)
    {
        X[k-1]=posl[2*(k-N/2-1)];
        Y[k-1]=posl[2*(k-N/2-1)+1];
    }
   /// cout<<N<<endl;
  ///  for(int i=0; i<=M; i++) cout<<C[i]<<" ";
   /// cout<<endl;
 ///  for(int i=0; i<N; i++) cout<<X[i]<<" "<<Y[i]<<endl;
    answer(C, X, Y);
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 212 KB Output is partially correct
2 Partially correct 46 ms 11060 KB Output is partially correct
3 Partially correct 51 ms 11124 KB Output is partially correct
4 Partially correct 52 ms 12072 KB Output is partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 212 KB Output is partially correct
2 Partially correct 46 ms 11060 KB Output is partially correct
3 Partially correct 51 ms 11124 KB Output is partially correct
4 Partially correct 52 ms 12072 KB Output is partially correct
5 Incorrect 62 ms 12316 KB wrong motion
6 Halted 0 ms 0 KB -