QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#326146#3098. Ancient MachineNATURAL60 40ms9840kbC++142.4kb2024-02-12 13:17:352024-02-12 13:17:35

Judging History

你现在查看的是最新测评结果

  • [2024-02-12 13:17:35]
  • 评测
  • 测评结果:0
  • 用时:40ms
  • 内存:9840kb
  • [2024-02-12 13:17:35]
  • 提交

Anna

#include "Anna.h"
#include<bits/stdc++.h>
using namespace std;
namespace ANNA
{
    int n,p;
    vector<char>s;
    int b[100110];
    unsigned long long a[64],sxc;
    inline unsigned long long get_rk(int l,int r)
    {
        if(l>r)return 0;
        if(l==r)return b[r];
        if(b[r])return a[r-l]+get_rk(l,r-2);
        return get_rk(l,r-1);
    }
    inline void solve()
    {
        for(int i=1,op=0,j;i<=n;++i)
        {
            if(op)
            {
                if(s[i-1]!='Z'){b[++p]=0;continue;}
                for(j=i;j<=n&&s[j-1]=='Z';++j);
                for(int k=i;k<j-1;++k)b[++p]=0;
                b[++p]=1,i=j-1;
            }
            else 
            {
                if(s[i-1]=='X')op=1,b[++p]=1,b[++p]=0;
                else b[++p]=0;
            }
        }
        a[0]=1,a[1]=2;
        for(int i=2;i<=63;++i)a[i]=a[i-1]+a[i-2];
        for(int i=1;i<=p;i+=63) 
        {
            sxc=get_rk(i,min(p,i+62));
            for(int j=0;j<44;++j)Send((sxc>>j)&1);
        }
        return ;
    }
}
void Anna(int n,vector<char>s) 
{
    ANNA::n=n,ANNA::s=s;
    ANNA::solve();
    return ;
}

Bruno

#include "Bruno.h"
#include<bits/stdc++.h>
using namespace std;
namespace BRUNO
{
    int n,p,np;
    vector<int>sbs;
    int b[100110];
    unsigned long long a[64],sxc;
    inline void get_rl(unsigned long long s,int h)
    {
        if(!h)return ;
        if(h==1)b[++p]=s;
        else
        {
            if(s<a[h-1])get_rl(s,h-1),b[++p]=0;
			else get_rl(s-a[h-1],h-2),b[++p]=0,b[++p]=1;
        }
        return ;
    }
    inline void solve() 
    {
        a[0]=1,a[1]=2;
        for(int i=2;i<=63;++i)a[i]=a[i-1]+a[i-2];
        for(int i=0,l,r;i<(int)sbs.size();i+=44) 
        {
            sxc=0;
            for(int j=i+43;j>=i;--j)sxc=sxc<<1|sbs[j];
            get_rl(sxc,63);
        }
        np=1;
        while(np<=p&&!b[np])Remove((np++)-1);
        if(np>=p)return ;++np;
        for(int i=np+1,lp=np;i<=p;) 
        {
            while(i<p&&!b[i+1])++i;
            for(int j=i-1;j>=lp+1;--j)Remove(j-2);
            if(i<=p)
            {
                lp=i++;
                Remove(lp-2);
            }
            else ++i;
        }
        Remove(np-2);
        return ;
    }
}
void Bruno(int n,int l,vector<int>SXC) 
{
    BRUNO::n=n,BRUNO::sbs=SXC;
    BRUNO::solve();
    return ;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3792kb

input:

18
Y X Y Z X Z X X Z Z Y Y Z Y Y Z X X

output:

44
10010100101100000000000000000000000000000000

input:

44
10010100101100000000000000000000000000000000

output:

3

result:

wrong answer Wrong Answer [3]

Subtask #2:

score: 0
Wrong Answer

Test #12:

score: 0
Wrong Answer
time: 40ms
memory: 9840kb

input:

100000
X Z X Z Z X Y Z Y X Y X Z Z Z Y X Z Y X Y Y X Y Y Y Z Y Z Z Y X X Y X X Y Y X X X Z Y Y Y Z Z Z Z Y X Y Y Z Z Z X Y Z X X X X Y X Y X X Z X Z Z Z X Y X X X Z X Z X X X Y Y Y Y Z X X Y Z Y Y X Z X Z Z Z Z Z Y Z Y X Y Y Y Y X Z Z Y Z Z Y Z Z Z X Z Z X X Z Z Z Z X X Z Y Y Z Y Y Z Z Y Y Z Y Z Y Z...

output:

69872
110101010101011011101011000000111010101101001100111000100101101011010111011000000101111000111010100000110110000011111101000110111001111010111011000010111010001000101110011110111101010100001001111111111001100100000101001110010100000100010011101100001100101100010101100100101000110000110100011001...

input:

69872
110101010101011011101011000000111010101101001100111000100101101011010111011000000101111000111010100000110110000011111101000110111001111010111011000010111010001000101110011110111101010100001001111111111001100100000101001110010100000100010011101100001100101100010101100100101000110000110100011001...

output:

3

result:

wrong answer Wrong Answer [3]