Submission #101795

# Submission time Handle Problem Language Result Execution time Memory
101795 2019-03-20T10:00:01 Z daniel920712 Mechanical Doll (IOI18_doll) C++14
6 / 100
91 ms 12168 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];
vector < int > C,x,y;
int X[1000005];
int Y[1000005];
void create_circuit(int M, vector < int > A)
{
    int N=A.size(),now=1,i;
    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(con[A[i]]==1) C[A[i]]=A[i+1];
        else if(con[A[i]]==2)
        {
            if(This[A[i]]==0)
            {
                C[A[i]]=-(now);
                X[now]=A[i+1];
                now++;
            }
            else Y[-C[A[i]]]=A[i+1];
            This[A[i]]++;
        }
        else if(con[A[i]]==4)
        {
            //printf("%d %d %d\n",i,A[i],This[A[i]]);
            if(This[A[i]]==0)
            {
                C[A[i]]=-now;
                X[now]=-(now+1);
                Y[now]=-(now+2);
                now+=3;
                m[A[i]]=X[-C[A[i]]];
                n[A[i]]=Y[-C[A[i]]];
                //printf("a:%d %d\n",m[A[i]],n[A[i]]);
                X[-m[A[i]]]=A[i+1];
            }
            else if(This[A[i]]==1) Y[-m[A[i]]]=A[i+1];
            else if(This[A[i]]==2) X[-n[A[i]]]=A[i+1];
            else if(This[A[i]]==3) Y[-n[A[i]]]=A[i+1];
            This[A[i]]++;
        }
        else
        {
            //printf("%d %d %d\n",i,A[i],This[A[i]]);
            if(This[A[i]]==0)
            {
                C[A[i]]=-now;
                X[now]=-(now+1);
                Y[now]=-(now+2);
                now+=3;
                m[A[i]]=X[-C[A[i]]];
                n[A[i]]=Y[-C[A[i]]];
                X[-m[A[i]]]=A[i+1];
                Y[-m[A[i]]]=A[i];
            }
            //else if(This[A[i]]==1) Y[-m[A[i]]]=A[i+1];
            else if(This[A[i]]==1) X[-n[A[i]]]=A[i+1];
            else if(This[A[i]]==2) Y[-n[A[i]]]=A[i+1];
            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 Correct 2 ms 204 KB Output is correct
2 Correct 23 ms 2476 KB Output is correct
3 Correct 19 ms 1980 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 13 ms 1836 KB Output is correct
6 Correct 28 ms 2868 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 204 KB Output is correct
2 Correct 23 ms 2476 KB Output is correct
3 Correct 19 ms 1980 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 13 ms 1836 KB Output is correct
6 Correct 28 ms 2868 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 49 ms 5556 KB Output is correct
9 Correct 45 ms 5300 KB Output is correct
10 Correct 76 ms 8132 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 204 KB Output is correct
2 Correct 23 ms 2476 KB Output is correct
3 Correct 19 ms 1980 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 13 ms 1836 KB Output is correct
6 Correct 28 ms 2868 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 49 ms 5556 KB Output is correct
9 Correct 45 ms 5300 KB Output is correct
10 Correct 76 ms 8132 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Incorrect 91 ms 12168 KB wrong motion
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 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 -