QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#19868 | #3098. Ancient Machine | Qingyu | 5 | 58ms | 12024kb | C++20 | 2.1kb | 2022-02-12 18:27:34 | 2023-01-17 10:36:50 |
Judging History
Anna
#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;
namespace{
const int maxn=1e5+5;
const int B=183;
#define INT __uint128_t
int a[maxn];
INT f[maxn];
const INT one=1;
}
char s[maxn];
void Anna(int n,vector<char>s){
f[1]=2,f[0]=1;
for(int i=2;i<B;i++)f[i]=f[i-1]+f[i-2];
/* s.resize(maxn); */
int lst=n;
for(int i=n-1;i>=0;i--){
if(s[i]=='Z'){
lst=i;break;
}
}
for(int i=0;i<20;i++)Send(lst>>i&1);
/* cout<<"ANNA: "; */
for(int i=0;i<n;i++){
if(s[i]=='X'&&(i==0||s[i-1]!='X'))a[i]=1;
/* cout<<a[i]<<" "; */
}
/* puts(""); */
for(int i=0;i<n;i+=B){
INT res=0;
for(int j=0;j<B;j++){
res+=a[i+j]*f[j];
}
/* cout<<"ANNA: "<<(long long )res<<endl; */
for(int i=0;i<128;i++)Send((res>>i)&one);
/* puts(""); */
}
}
Bruno
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
namespace{
const int maxn=1e5+5;
const int B=183;
#define INT __uint128_t
INT f[maxn];
INT bs[maxn];
int g[maxn];
const INT one=1;
}
void Bruno(int N,int L,std::vector<int>a){
int Z=0;
bs[0]=1;f[1]=2,f[0]=1;
for(int i=1;i<128;i++)bs[i]=bs[i-1]*2;
for(int i=2;i<B;i++)f[i]=f[i-1]+f[i-2];
/* cout<<"Bruno get: "; */
/* for(int i=0;i<L;i++)cout<<a[i];cout<<endl; */
for(int i=0;i<20;i++)Z|=(1<<i)*a[i];
/* cout<<"Z "<<Z<<endl; */
for(int i=0;i+20<L;i+=128){
INT res=0;
for(int j=0;j<128;j++){
res+=bs[j]*a[i+j+20];
}
/* cout<<"getres "<<(long long)res<<endl; */
for(int j=B-1;j>=0;j--){
if(res>=f[j])res-=f[j],g[i/128*B+j]=1;
}
}
/* for(int i=0;i<N;i++)cout<<g[i]<<" "; */
/* puts(""); */
int cur=N-1;
while(cur>Z)Remove(cur),--cur;
if(cur==Z)--cur;
while(cur>=0){
int ps=cur;
while(!g[ps]&&ps>0)--ps;
/* cout<<"round "<<ps<<" "<<cur<<endl; */
for(int j=ps+1;j<=cur;j++)Remove(j);
Remove(ps);
cur=ps-1;
}
if(Z<N)Remove(Z);
}
詳細信息
Subtask #1:
score: 5
Accepted
Test #1:
score: 100
Accepted
time: 4ms
memory: 5760kb
input:
18 Y X Y Z X Z X X Z Z Y Y Z Y Y Z X X
output:
148 1111000000000000000011101100010100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
input:
148 1111000000000000000011101100010100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
output:
0 148 3
result:
ok n = 18, D = 148, L = 3
Test #2:
score: 100
Accepted
time: 4ms
memory: 5696kb
input:
18 X Z X Y Y Y X Z X Y Z Z Z Z Y Z Z Y
output:
148 0000100000000000000000001010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
input:
148 0000100000000000000000001010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
output:
0 148 3
result:
ok n = 18, D = 148, L = 3
Test #3:
score: 100
Accepted
time: 4ms
memory: 5692kb
input:
18 Y Z Z Y Z X X Z Y Y Z Z Z Y X X Z Y
output:
148 0000100000000000000000010111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
input:
148 0000100000000000000000010111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
output:
0 148 2
result:
ok n = 18, D = 148, L = 2
Test #4:
score: 100
Accepted
time: 4ms
memory: 5788kb
input:
18 X Z Z X Z X X Z X Y Y X X Z X Y Z X
output:
148 0000100000000000000011000110101010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
input:
148 0000100000000000000011000110101010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
output:
0 148 2
result:
ok n = 18, D = 148, L = 2
Test #5:
score: 100
Accepted
time: 4ms
memory: 5676kb
input:
18 X Y X Y Y X X Z Y Z Y X Z Y Y X X Z
output:
148 1000100000000000000011101100111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
input:
148 1000100000000000000011101100111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
output:
0 148 5
result:
ok n = 18, D = 148, L = 5
Test #6:
score: 100
Accepted
time: 4ms
memory: 5652kb
input:
18 X X Y Z X Y Y Y X X Z X X X Z X Z Z
output:
148 1000100000000000000001100110111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
input:
148 1000100000000000000001100110111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
output:
0 148 2
result:
ok n = 18, D = 148, L = 2
Test #7:
score: 100
Accepted
time: 4ms
memory: 5692kb
input:
3 X Y Z
output:
148 0100000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
input:
148 0100000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
output:
0 148 1
result:
ok n = 3, D = 148, L = 1
Test #8:
score: 100
Accepted
time: 4ms
memory: 5656kb
input:
3 Z Y X
output:
148 0000000000000000000011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
input:
148 0000000000000000000011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
output:
0 148 0
result:
ok n = 3, D = 148, L = 0
Test #9:
score: 100
Accepted
time: 0ms
memory: 7804kb
input:
18 X X X X X X X X X X X X X X X X X X
output:
148 0100100000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
input:
148 0100100000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
output:
0 148 0
result:
ok n = 18, D = 148, L = 0
Test #10:
score: 100
Accepted
time: 4ms
memory: 5668kb
input:
18 Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y
output:
148 0100100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
input:
148 0100100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
output:
0 148 0
result:
ok n = 18, D = 148, L = 0
Test #11:
score: 100
Accepted
time: 0ms
memory: 5696kb
input:
18 Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z
output:
148 1000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
input:
148 1000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
output:
0 148 0
result:
ok n = 18, D = 148, L = 0
Subtask #2:
score: 0
Wrong Answer
Test #12:
score: 0
Wrong Answer
time: 58ms
memory: 12024kb
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:
70036 101110010110000110001111101001000100100000000000110101101111001110010100011010011000001110110001000111101011101000000001111011010001001111011111100000000000010100110110111101010110011101111011110111111111100011110000000111101000110100100100110001010000001100111100001111011110011010010010111100...
input:
70036 101110010110000110001111101001000100100000000000110101101111001110010100011010011000001110110001000111101011101000000001111011010001001111011111100000000000010100110110111101010110011101111011110111111111100011110000000111101000110100100100110001010000001100111100001111011110011010010010111100...
output:
0 70036 22129
result:
wrong answer your query is valid but your solution is not optimal: read 22129 but expected 22133