Submission #1294534

#TimeUsernameProblemLanguageResultExecution timeMemory
1294534simona1230Ancient Machine (JOI21_ancient_machine)C++20
0 / 100
52 ms7472 KiB
#include "Anna.h"
#include <bits/stdc++.h>

namespace
{

}

void Anna(int N, std::vector<char> S) {
    for(int i=0;i<N;i++)
        if(S[i]=='X')Send(1);
        else Send(0);

    /*int x=-1;
    int z=-1;
    for(int i=0;i<N;i++)
    {
        if(S[i]=='X'&&x==-1)
        {
            x=i;
            for(int j=0;j<=16;j++)
                if((1<<j)&x)Send(1);
                else Send(0);
        }
    }

    for(int i=N-1;i>=0;i--)
    {
        if(S[i]=='Z'&&z==-1)
        {
            z=i;
            for(int j=0;j<=16;j++)
                if((1<<j)&z)Send(1);
                else Send(0);
        }
    }*/

    for(int i=0;i<N;i++)
        if(S[i]=='Y')Send(1);
        else Send(0);
}
#include "Bruno.h"
#include <bits/stdc++.h>

namespace
{
    char c[100001];
    int h[100001];
}

void Bruno(int N, int L, std::vector<int> A)
{
    if(N>7)std::cout<<4<<std::endl;
    /*if(A.size()!=N+34)
    {
        for(int i=0;i<N;i++)
            Remove(i);
        return;
    }

    int x=0;
    for(int i=0;i<=16;i++)
        if(A[i]==1)x+=(1<<i);
    for(int i=17;i<=34;i++)
        if(A[i]==1)z+=(1<<j)*/

    for(int i=0;i<N;i++)
        c[i]='Z';
    for(int i=0;i<N;i++)
        if(A[i]==1)c[i]='X';
    for(int i=N;i<2*N;i++)
        if(A[i]==1)c[i-N]='Y';

    int f=-1,l=2;
    for(int i=0;i<N;i++)
    {
        //std::cout<<c[i]<<" ";
        if(f==-1)
        {
            if(c[i]=='X')
            {
                f=i;
                h[i]=1;
            }
        }
        else
        {
            if(l==2&&c[i]=='Y')l=1,h[i]=1;
            else if(l==1&&c[i]=='Z')l=2,h[i]=1;
        }
    }
    //std::cout<<std::endl;

    for(int i=0;i<N;i++)
        if(!h[i])Remove(i);
    for(int i=0;i<N;i++)
        if(h[i]&&i!=f)Remove(i);
        Remove(f);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...