QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#326126 | #3098. Ancient Machine | NATURAL6 | 0 | 24ms | 10372kb | C++14 | 2.1kb | 2024-02-12 12:48:04 | 2024-02-12 12:48:04 |
Judging History
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;
vector<int>sbs;
int b[100110];
unsigned long long a[64],sxc;
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=min(i+43,(int)sbs.size()-1);j>=i;--j)sxc=sxc<<1|sbs[j];
l=i/44*63,r=l+62;
for(int j=l;j<=r;++j)if(sxc>=a[r-j])b[j]=1,sxc-=a[r-j];
}
p=0;
while(p<n&&!b[p])Remove(p++);
if(p==n)return ;
for(int i=p+1,lp=p;i<n;++i)
{
while(i<n&&!b[i+1])++i;
for(int j=i-1;j>=lp+1;--j)Remove(j);
if(i<n)Remove(lp=i++);
}
Remove(p);
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: 3864kb
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:
0 44 0
result:
wrong answer your query is valid but your solution is not optimal: read 0 but expected 3
Subtask #2:
score: 0
Wrong Answer
Test #12:
score: 0
Wrong Answer
time: 24ms
memory: 10372kb
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:
0 69872 2100
result:
wrong answer your query is valid but your solution is not optimal: read 2100 but expected 22133