Submission #101814

# Submission time Handle Problem Language Result Execution time Memory
101814 2019-03-20T11:53:53 Z daniel920712 Mechanical Doll (IOI18_doll) C++14
0 / 100
1000 ms 8140 KB
#include "doll.h"
#include <vector>
#include <stdio.h>

using namespace std;
int con[1000005]={0};
int This[1000005]={0};
int m[1000005];
int n[1000005];
int start[1000005]={0};
vector < int > C,x,y;
int X[1000005]={0};
int Y[1000005]={0};
int now=1;
int t[1000005]={0};
void build(int N,int here,int n,int all)
{
    if(n==all) return ;
    if(n%2)
    {
        if(!Y[here])
        {
            Y[here]=-now;
            now++;
        }
        build(N/2,Y[here],n,all);
    }
    else
    {
        if(!X[here])
        {
            X[here]=-now;
            now++;
        }
        build(N/2,X[here],n,all);
    }
}
void create_circuit(int M, vector < int > A)
{
    int N=A.size(),i,temp;
    C.push_back(A[0]);
    for(i=1;i<=M;i++) C.push_back(i);
    for(i=0;i<N;i++) con[A[i]]++;
    A.push_back(0);
    for(i=0;i<N;i++)
    {
        if(!This[A[i]])
        {
            C[A[i]]=-now;
            now++;
            t[A[i]]=0;
            temp=1;
            while(temp<con[A[i]])
            {
                temp*=2;
                t[A[i]]++;
            }
            start[A[i]]=temp-con[A[i]];
            for(int j=0;j<temp;j++) build(j,C[A[i]],0,t[A[i]]);

        }
        build(This[A[i]]+start[A[i]],C[A[i]],0,t[A[i]]);
        This[A[i]]++;




    }

    //for(auto i:C) printf("%d\n",i);
    //for(i=1;i<now;i++) printf("%d %d\n",X[i],Y[i]);
    for(i=1;i<now;i++) x.push_back(X[i]);
    for(i=1;i<now;i++) y.push_back(Y[i]);
    answer(C,x,y);

}
# 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 -
# 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 Execution timed out 1068 ms 8076 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1085 ms 8140 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1085 ms 8140 KB Time limit exceeded
2 Halted 0 ms 0 KB -