QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#20408 | #3098. Ancient Machine | uezexh# | 5 | 52ms | 9320kb | C++20 | 1.4kb | 2022-02-16 07:33:01 | 2023-01-17 10:44:58 |
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){
while(n%64)
++n;
return n;
}(N));
ll fib[66]={0,1};
for(int i=2;i<66;++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[65-j];
for(int j=0;j<45;++j)
Send((s>>j)&1);
}
}
Bruno
#include "Bruno.h"
#include <vector>
using namespace std;
void Bruno(int N,int L,vector<int> A){
using ll=long long;
vector<int> a([](int n){
while(n%64)
++n;
return n;
}(N));
ll fib[66]={0,1};
for(int i=2;i<66;++i)
fib[i]=fib[i-1]+fib[i-2];
for(int i=0;i*45<int(A.size());++i){
ll s=0;
for(int j=0;j<45;++j)
if(A[i*45+j])
s|=(1LL<<j);
for(int j=0;j<64;++j)
if(s>=fib[65-j]){
s-=fib[65-j];
a[i*64+j]=1;
}
}
vector<int> stk;
for(int i=0;i<N;++i)
if(a[i]){
if(!stk.size()){
stk.push_back(i);
}else{
while(int(stk.size())>1){
Remove(stk.back());
stk.pop_back();
}
Remove(i);
}
}else{
if(stk.size())
stk.push_back(i);
else
Remove(i);
}
while(stk.size()){
Remove(stk.back());
stk.pop_back();
}
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 5
Accepted
Test #1:
score: 100
Accepted
time: 4ms
memory: 3068kb
input:
18 Y X Y Z X Z X X Z Z Y Y Z Y Y Z X X
output:
45 111110000110100111010010011010100100000011110
input:
45 111110000110100111010010011010100100000011110
output:
0 45 3
result:
ok n = 18, D = 45, L = 3
Test #2:
score: 100
Accepted
time: 4ms
memory: 3188kb
input:
18 X Z X Y Y Y X Z X Y Z Z Z Z Y Z Z Y
output:
45 000111001100101100111001000010100000110000001
input:
45 000111001100101100111001000010100000110000001
output:
0 45 3
result:
ok n = 18, D = 45, L = 3
Test #3:
score: 100
Accepted
time: 4ms
memory: 3176kb
input:
18 Y Z Z Y Z X X Z Y Y Z Z Z Y X X Z Y
output:
45 101101110001001101111110100010100000000001000
input:
45 101101110001001101111110100010100000000001000
output:
0 45 2
result:
ok n = 18, D = 45, L = 2
Test #4:
score: 100
Accepted
time: 0ms
memory: 3132kb
input:
18 X Z Z X Z X X Z X Y Y X X Z X Y Z X
output:
45 110001001000011111000111101000100111011000011
input:
45 110001001000011111000111101000100111011000011
output:
0 45 2
result:
ok n = 18, D = 45, L = 2
Test #5:
score: 100
Accepted
time: 4ms
memory: 3136kb
input:
18 X Y X Y Y X X Z Y Z Y X Z Y Y X X Z
output:
45 011100111001111000010100110011110001011000001
input:
45 011100111001111000010100110011110001011000001
output:
0 45 5
result:
ok n = 18, D = 45, L = 5
Test #6:
score: 100
Accepted
time: 4ms
memory: 3088kb
input:
18 X X Y Z X Y Y Y X X Z X X X Z X Z Z
output:
45 101001110101011011001011111110001100111011001
input:
45 101001110101011011001011111110001100111011001
output:
0 45 2
result:
ok n = 18, D = 45, L = 2
Test #7:
score: 100
Accepted
time: 4ms
memory: 3136kb
input:
3 X Y Z
output:
45 111111100101011101010100100011111100100110101
input:
45 111111100101011101010100100011111100100110101
output:
0 45 1
result:
ok n = 3, D = 45, L = 1
Test #8:
score: 100
Accepted
time: 0ms
memory: 3080kb
input:
3 Z Y X
output:
45 010001110010011000001101111000110110111110100
input:
45 010001110010011000001101111000110110111110100
output:
0 45 0
result:
ok n = 3, D = 45, L = 0
Test #9:
score: 100
Accepted
time: 4ms
memory: 3064kb
input:
18 X X X X X X X X X X X X X X X X X X
output:
45 101110011010000101011110100101001011100111110
input:
45 101110011010000101011110100101001011100111110
output:
0 45 0
result:
ok n = 18, D = 45, L = 0
Test #10:
score: 100
Accepted
time: 0ms
memory: 3124kb
input:
18 Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y
output:
45 000000000000000000000000000000000000000000000
input:
45 000000000000000000000000000000000000000000000
output:
0 45 0
result:
ok n = 18, D = 45, L = 0
Test #11:
score: 100
Accepted
time: 0ms
memory: 3172kb
input:
18 Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z
output:
45 000000000000000000000000000000000000000000000
input:
45 000000000000000000000000000000000000000000000
output:
0 45 0
result:
ok n = 18, D = 45, L = 0
Subtask #2:
score: 0
Wrong Answer
Test #12:
score: 98
Acceptable Answer
time: 50ms
memory: 9248kb
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:
70335 010011111001110100001001110001111100111001001111010101110111011000010001110110100010101000010110111110001100100010110101010100100100110101100010000011010011111011110101101011101100100000111011111000110111010011110010100101101011000001100000000111110101111101101010110001111010101000001001001001...
input:
70335 010011111001110100001001110001111100111001001111010101110111011000010001110110100010101000010110111110001100100010110101010100100100110101100010000011010011111011110101101011101100100000111011111000110111010011110010100101101011000001100000000111110101111101101010110001111010101000001001001001...
output:
0 70335 22133
result:
points 0.98947368420 n = 100000, D = 70335, L = 22133
Test #13:
score: 98
Acceptable Answer
time: 34ms
memory: 9172kb
input:
100000 Z X X Y Z Z Z Y Z X Y Y Z X X Z Z Z Y Z X Y X Y X Z Y X Z X Y X Y Y Z X X Z X Z Y Z Y Z Z Z Y X Z X Z Y Y Y Z Y Z Y Z X Y X Z Z X Y X Y Z X Y Z Y X Y X X Z Z X Z X X Z X X X X Y X X Z Z X Y Y Y Y X Y X X Z Y Z Y Y Z X X Z Z Y Y X Z Y Y X Y Z Y Z Y Y Z Z X Z Y Z Z Z X Y Z Z X X X X Z Y X Y Y Z...
output:
70335 001010001111111101110000011011000001011101010111110100110110101110110101010111110101101000011100001011111101110101001011111000001001001110110101000000100100011010110011010000101000111100010111011110110000110011010110101111000101000010010001100111111001000101011000011000010000111001011001010011...
input:
70335 001010001111111101110000011011000001011101010111110100110110101110110101010111110101101000011100001011111101110101001011111000001001001110110101000000100100011010110011010000101000111100010111011110110000110011010110101111000101000010010001100111111001000101011000011000010000111001011001010011...
output:
0 70335 22275
result:
points 0.98947368420 n = 100000, D = 70335, L = 22275
Test #14:
score: 0
Wrong Answer
time: 52ms
memory: 9320kb
input:
100000 X Z Y X Z X X Z Y Z Y Y Y Z Y Z X X Z X X Y Z X X Z Y X Y Y Z X Z Y Z X X X X Z X Y X Z X Z X X X Y X Y Z Z Z Z Z Z Z Z Y X Y Z X Z Y Z Y X Y Z Y Z Y X Y Z X Z Z Z Y X Y Y X X X X Y X X Y Z Z X Z Y Z Z Y X Y X Z Z Z X X Z X Z Z Z Z Y X Z Z X X Z Z Y X X Y Y Y X Y Y Y X X Y Y Z X Z Y Y X X Y Z...
output:
70335 101001000000000101110110001000000111010101001000001000101101100011100000100001011100001110101100100010011001101000011001101011010000000110011100111011110101001111101010010010100000010111111001110001101001000111111101011101001000011000011110011001001111011111011100001000000100111011000001000001...
input:
70335 101001000000000101110110001000000111010101001000001000101101100011100000100001011100001110101100100010011001101000011001101011010000000110011100111011110101001111101010010010100000010111111001110001101001000111111101011101001000011000011110011001001111011111011100001000000100111011000001000001...
output:
0 70335 22176
result:
wrong answer your query is valid but your solution is not optimal: read 22176 but expected 22177