QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#20264 | #3098. Ancient Machine | BuildNoMore | 5 | 36ms | 9908kb | C++14 | 2.0kb | 2022-02-15 10:14:30 | 2023-01-17 10:42:30 |
Judging History
Anna
#include "Anna.h"
#include<bits/stdc++.h>
#define rep(i,x,y) for(int i=x;i<=y;++i)
#define per(i,x,y) for(int i=x;i>=y;--i)
#define vep(i,x) for(unsigned int i=0;i<x.size();++i)
#define mar(o) for(int E=fst[o];E;E=e[E].nxt)
#define v e[E].to
#define lon unsigned long long
using namespace std;
const int n7=101234;
lon f[123];int is[n7];
void Dfib(){
f[0]=1,f[1]=2;
rep(i,2,64){
f[i]=f[i-1]+f[i-2];
}
}
void Anna(int n,vector <char> a){
int wei=-1;
vep(i,a){
if(a[i]=='X'){
wei=i;
rep(j,0,15)Send(i&1),i>>=1;
break;
}
}
if(wei==-1){
rep(j,0,15)Send(1);
return;
}
rep(i,wei+1,n-1){
if(a[i]=='Z'&&a[i+1]^'Z')is[i]=1;
}
Dfib();
rep(i,wei+1,n-1){
int l=i,r=min(n-1,i+62);lon x=0,tot=0;
rep(j,l,r)if(is[j])x|=( 1<<(j-l) );
per(j,63,0){
if( x&(1ll<<j) )tot+=f[j];
}
rep(j,0,44)Send(tot&1),tot>>=1;
i=r;
}
}
Bruno
#include "Bruno.h"
#include<bits/stdc++.h>
#define rep(i,x,y) for(int i=x;i<=y;++i)
#define per(i,x,y) for(int i=x;i>=y;--i)
#define vep(i,x) for(unsigned int i=0;i<x.size();++i)
#define mar(o) for(int E=fst[o];E;E=e[E].nxt)
#define v e[E].to
#define lon unsigned long long
using namespace std;
const int n7=101234;
lon f[123];int b[n7];
void Dfib(){
f[0]=1,f[1]=2;
rep(i,2,64){
f[i]=f[i-1]+f[i-2];
}
}
void Bruno(int n,int m,vector <int> a){
bool flag=0;
rep(i,0,15){
flag|=(a[i]==0);
}
if(!flag){
rep(i,0,n-1)Remove(i);
return;
}
int wei=0;
per(i,15,0){
wei=(wei<<1)+a[i];
}
Dfib();
rep(i,0,wei-1)Remove(i);
rep(i,16,m-1){
int l=i,r=min(m-1,i+44);lon x=0,tot=0;
per(j,r,l){
tot=(tot<<1)+a[j];
}
per(j,63,0){
if(tot>=f[j])x|=(1ll<<j),tot-=f[j];
}
rep(j,l,r){
if( x&( 1ll<<(j-l) ) )b[j-15+wei]=1;
}
i=r;
}
int l=wei+1;
rep(i,wei,n-1){
if(b[i]){
per(j,i-1,l)Remove(j);
Remove(i),l=i+1;
}
}
rep(i,l,n-1)Remove(i);
Remove(wei);
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 5
Accepted
Test #1:
score: 100
Accepted
time: 4ms
memory: 3640kb
input:
18 Y X Y Z X Z X X Z Z Y Y Z Y Y Z X X
output:
61 1000000000000000110110001100000000000000000000000000000000000
input:
61 1000000000000000110110001100000000000000000000000000000000000
output:
0 61 3
result:
ok n = 18, D = 61, L = 3
Test #2:
score: 100
Accepted
time: 4ms
memory: 3736kb
input:
18 X Z X Y Y Y X Z X Y Z Z Z Z Y Z Z Y
output:
61 0000000000000000001100111110000000000000000000000000000000000
input:
61 0000000000000000001100111110000000000000000000000000000000000
output:
0 61 3
result:
ok n = 18, D = 61, L = 3
Test #3:
score: 100
Accepted
time: 4ms
memory: 3696kb
input:
18 Y Z Z Y Z X X Z Y Y Z Z Z Y X X Z Y
output:
61 1010000000000000111001010000000000000000000000000000000000000
input:
61 1010000000000000111001010000000000000000000000000000000000000
output:
0 61 2
result:
ok n = 18, D = 61, L = 2
Test #4:
score: 100
Accepted
time: 4ms
memory: 3636kb
input:
18 X Z Z X Z X X Z X Y Y X X Z X Y Z X
output:
61 0000000000000000010010111110000000000000000000000000000000000
input:
61 0000000000000000010010111110000000000000000000000000000000000
output:
0 61 2
result:
ok n = 18, D = 61, L = 2
Test #5:
score: 100
Accepted
time: 4ms
memory: 3640kb
input:
18 X Y X Y Y X X Z Y Z Y X Z Y Y X X Z
output:
61 0000000000000000101100101101000000000000000000000000000000000
input:
61 0000000000000000101100101101000000000000000000000000000000000
output:
0 61 5
result:
ok n = 18, D = 61, L = 5
Test #6:
score: 100
Accepted
time: 2ms
memory: 3704kb
input:
18 X X Y Z X Y Y Y X X Z X X X Z X Z Z
output:
61 0000000000000000011010110011000000000000000000000000000000000
input:
61 0000000000000000011010110011000000000000000000000000000000000
output:
0 61 2
result:
ok n = 18, D = 61, L = 2
Test #7:
score: 100
Accepted
time: 4ms
memory: 3648kb
input:
3 X Y Z
output:
61 0000000000000000010000000000000000000000000000000000000000000
input:
61 0000000000000000010000000000000000000000000000000000000000000
output:
0 61 1
result:
ok n = 3, D = 61, L = 1
Test #8:
score: 100
Accepted
time: 4ms
memory: 3652kb
input:
3 Z Y X
output:
16 0100000000000000
input:
16 0100000000000000
output:
0 16 0
result:
ok n = 3, D = 16, L = 0
Test #9:
score: 100
Accepted
time: 4ms
memory: 3700kb
input:
18 X X X X X X X X X X X X X X X X X X
output:
61 0000000000000000000000000000000000000000000000000000000000000
input:
61 0000000000000000000000000000000000000000000000000000000000000
output:
0 61 0
result:
ok n = 18, D = 61, L = 0
Test #10:
score: 100
Accepted
time: 4ms
memory: 3724kb
input:
18 Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y
output:
16 1111111111111111
input:
16 1111111111111111
output:
0 16 0
result:
ok n = 18, D = 16, L = 0
Test #11:
score: 100
Accepted
time: 2ms
memory: 3768kb
input:
18 Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z
output:
16 1111111111111111
input:
16 1111111111111111
output:
0 16 0
result:
ok n = 18, D = 16, L = 0
Subtask #2:
score: 0
Wrong Answer
Test #12:
score: 0
Wrong Answer
time: 36ms
memory: 9908kb
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:
71476 000000000000000011001001100111100000100000000000000000000000001011011000100110110100000000000000000000000001100100101100110101000100101101000001110001001000011010100000010100000000000000000000000001011011001010111101110000000000000000000000001000110000001000110111000101101000001110001011101011...
input:
71476 000000000000000011001001100111100000100000000000000000000000001011011000100110110100000000000000000000000001100100101100110101000100101101000001110001001000011010100000010100000000000000000000000001011011001010111101110000000000000000000000001000110000001000110111000101101000001110001011101011...
output:
0 71476 8028
result:
wrong answer your query is valid but your solution is not optimal: read 8028 but expected 22133