QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#20395 | #3098. Ancient Machine | uezexh# | 5 | 56ms | 9468kb | C++20 | 1.4kb | 2022-02-15 23:31:45 | 2023-01-17 10:44:42 |
Judging History
Anna
#include "Anna.h"
#include <vector>
using namespace std;
void Anna(int N,vector<char> S){
using ll=long long;
vector<int> a([](int n){
int x=64;
while(x<n)
x<<=1;
return x;
}(N));
ll fib[67]={0,1};
for(int i=2;i<67;++i)
fib[i]=fib[i-1]+fib[i-2];
bool f=false;
for(int i=0;i<N;++i){
if(!f){
if(S[i]=='X'){
f=true;
a[i]=1;
++i;
}
}else if(S[i]=='Z'){
if(S[i-1]=='Z')
a[i-1]=0;
a[i]=1;
}
}
for(int i=0;i<int(a.size());i+=64){
ll s=0;
for(int j=0;j<64;++j)
if(a[i+j])
s+=fib[64-j];
for(int j=0;j<44;++j)
Send((s>>j)&1);
}
}
Bruno
#include "Bruno.h"
using namespace std;
void Bruno(int N,int L,vector<int> A){
using ll=long long;
vector<int> a([](int n){
int x=64;
while(x<n)
x<<=1;
return x;
}(N));
ll fib[67]={0,1};
for(int i=2;i<67;++i)
fib[i]=fib[i-1]+fib[i-2];
for(int i=0;i<int(A.size());i+=44){
ll s=0;
for(int j=0;j<44;++j)
if(A[i+j])
s|=(1LL<<j);
for(int j=0;j<64;++j)
if(s>=fib[64-j]){
s-=fib[64-j];
a[i+(j++)]=1;
}
}
vector<int> p;
for(int i=0;i<N;++i)
if(a[i])
p.push_back(i);
if(int(p.size())<=1){
for(int i=0;i<N;++i)
Remove(i);
}else{
for(int i=0;i<p[0];++i)
Remove(i);
for(int i=p.back()+1;i<N;++i)
Remove(i);
for(int i=1;i<int(p.size());++i){
for(int j=p[i]-1;j>p[i-1];--j)
Remove(j);
Remove(p[i]);
}
Remove(p[0]);
}
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 5
Accepted
Test #1:
score: 100
Accepted
time: 4ms
memory: 3176kb
input:
18 Y X Y Z X Z X X Z Z Y Y Z Y Y Z X X
output:
44 10101011110101000110011110001101011000101001
input:
44 10101011110101000110011110001101011000101001
output:
0 44 3
result:
ok n = 18, D = 44, L = 3
Test #2:
score: 100
Accepted
time: 4ms
memory: 3128kb
input:
18 X Z X Y Y Y X Z X Y Z Z Z Z Y Z Z Y
output:
44 11111000101101010010101111001010100000000101
input:
44 11111000101101010010101111001010100000000101
output:
0 44 3
result:
ok n = 18, D = 44, L = 3
Test #3:
score: 100
Accepted
time: 4ms
memory: 3192kb
input:
18 Y Z Z Y Z X X Z Y Y Z Z Z Y X X Z Y
output:
44 01111111110110101000101010000101001111001000
input:
44 01111111110110101000101010000101001111001000
output:
0 44 2
result:
ok n = 18, D = 44, L = 2
Test #4:
score: 100
Accepted
time: 4ms
memory: 3064kb
input:
18 X Z Z X Z X X Z X Y Y X X Z X Y Z X
output:
44 00010011110111101000111001011010100110001111
input:
44 00010011110111101000111001011010100110001111
output:
0 44 2
result:
ok n = 18, D = 44, L = 2
Test #5:
score: 100
Accepted
time: 4ms
memory: 3276kb
input:
18 X Y X Y Y X X Z Y Z Y X Z Y Y X X Z
output:
44 01110011111011010011011000101010001001000101
input:
44 01110011111011010011011000101010001001000101
output:
0 44 5
result:
ok n = 18, D = 44, L = 5
Test #6:
score: 100
Accepted
time: 4ms
memory: 3124kb
input:
18 X X Y Z X Y Y Y X X Z X X X Z X Z Z
output:
44 01110010001010111111100100100010101000000011
input:
44 01110010001010111111100100100010101000000011
output:
0 44 2
result:
ok n = 18, D = 44, L = 2
Test #7:
score: 100
Accepted
time: 4ms
memory: 3136kb
input:
3 X Y Z
output:
44 00101001001110111100011111011111101010101011
input:
44 00101001001110111100011111011111101010101011
output:
0 44 1
result:
ok n = 3, D = 44, L = 1
Test #8:
score: 100
Accepted
time: 4ms
memory: 3168kb
input:
3 Z Y X
output:
44 10011011110111011001100001011001111101011100
input:
44 10011011110111011001100001011001111101011100
output:
0 44 0
result:
ok n = 3, D = 44, L = 0
Test #9:
score: 100
Accepted
time: 0ms
memory: 3136kb
input:
18 X X X X X X X X X X X X X X X X X X
output:
44 11011101000001000101001110000110011001011001
input:
44 11011101000001000101001110000110011001011001
output:
0 44 0
result:
ok n = 18, D = 44, L = 0
Test #10:
score: 100
Accepted
time: 0ms
memory: 3272kb
input:
18 Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y
output:
44 00000000000000000000000000000000000000000000
input:
44 00000000000000000000000000000000000000000000
output:
0 44 0
result:
ok n = 18, D = 44, L = 0
Test #11:
score: 100
Accepted
time: 4ms
memory: 3276kb
input:
18 Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z
output:
44 00000000000000000000000000000000000000000000
input:
44 00000000000000000000000000000000000000000000
output:
0 44 0
result:
ok n = 18, D = 44, L = 0
Subtask #2:
score: 0
Wrong Answer
Test #12:
score: 0
Wrong Answer
time: 56ms
memory: 9468kb
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:
90112 111010100011101011111000011000011110011011011100001010011011111101000110100010000101100010001010011101011000110011111100101000111110111010010010100110011110001000110110001000100011100001010111010101010100101100101111101110010001110110101000110111010101110101110101010011000000010010001100110011...
input:
90112 111010100011101011111000011000011110011011011100001010011011111101000110100010000101100010001010011101011000110011111100101000111110111010010010100110011110001000110110001000100011100001010111010101010100101100101111101110010001110110101000110111010101110101110101010011000000010010001100110011...
output:
0 90112 8870
result:
wrong answer your query is valid but your solution is not optimal: read 8870 but expected 22133