QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#20593 | #3098. Ancient Machine | AFewSuns# | 0 | 50ms | 11116kb | C++14 | 3.7kb | 2022-02-16 19:11:11 | 2023-01-17 10:46:25 |
Judging History
Anna
#include<bits/stdc++.h>
#include "Anna.h"
using namespace std;
namespace my_std{
#define ll long long
#define bl bool
ll my_pow(ll a,ll b,ll mod){
ll res=1;
if(!b) return 1;
while(b){
if(b&1) res=(res*a)%mod;
a=(a*a)%mod;
b>>=1;
}
return res;
}
ll qpow(ll a,ll b){
ll res=1;
if(!b) return 1;
while(b){
if(b&1) res*=a;
a*=a;
b>>=1;
}
return res;
}
#define db double
#define pf printf
#define pc putchar
#define fr(i,x,y) for(register ll i=(x);i<=(y);i++)
#define pfr(i,x,y) for(register ll i=(x);i>=(y);i--)
#define go(u) for(ll i=head[u];i;i=e[i].nxt)
#define enter pc('\n')
#define space pc(' ')
#define fir first
#define sec second
#define MP make_pair
#define il inline
#define inf 8e18
#define random(x) rand()*rand()%(x)
#define inv(a,mod) my_pow((a),(mod-2),(mod))
il ll read(){
ll sum=0,f=1;
char ch=0;
while(!isdigit(ch)){
if(ch=='-') f=-1;
ch=getchar();
}
while(isdigit(ch)){
sum=sum*10+(ch^48);
ch=getchar();
}
return sum*f;
}
il void write(ll x){
if(x<0){
x=-x;
pc('-');
}
if(x>9) write(x/10);
pc(x%10+'0');
}
il void writeln(ll x){
write(x);
enter;
}
il void writesp(ll x){
write(x);
space;
}
}
using namespace my_std;
ll res[110000],f[110];
char a[100010];
void Anna(int n,vector<char> S){
ll posa=0;
fr(i,1,n) a[i]=S[i-1];
fr(i,1,n){
if(a[i]=='X'){
posa=i;
break;
}
}
res[posa]=1;
fr(i,posa+1,n) if(a[i]=='Z'&&a[i+1]!='Z') res[i]=1;
f[0]=1;
f[1]=2;
fr(i,2,63) f[i]=f[i-2]+f[i-1];
for(ll i=1;i<=n;i+=63){
ll rk=0;
pfr(j,63,1) if(res[i+j-1]) rk+=f[j-1];
fr(j,0,43){
if(rk&(1ll<<j)) Send(1);
else Send(0);
}
}
}
Bruno
#include<bits/stdc++.h>
#include "Bruno.h"
using namespace std;
namespace my_std{
#define ll long long
#define bl bool
ll my_pow(ll a,ll b,ll mod){
ll res=1;
if(!b) return 1;
while(b){
if(b&1) res=(res*a)%mod;
a=(a*a)%mod;
b>>=1;
}
return res;
}
ll qpow(ll a,ll b){
ll res=1;
if(!b) return 1;
while(b){
if(b&1) res*=a;
a*=a;
b>>=1;
}
return res;
}
#define db double
#define pf printf
#define pc putchar
#define fr(i,x,y) for(register ll i=(x);i<=(y);i++)
#define pfr(i,x,y) for(register ll i=(x);i>=(y);i--)
#define go(u) for(ll i=head[u];i;i=e[i].nxt)
#define enter pc('\n')
#define space pc(' ')
#define fir first
#define sec second
#define MP make_pair
#define il inline
#define inf 8e18
#define random(x) rand()*rand()%(x)
#define inv(a,mod) my_pow((a),(mod-2),(mod))
il ll read(){
ll sum=0,f=1;
char ch=0;
while(!isdigit(ch)){
if(ch=='-') f=-1;
ch=getchar();
}
while(isdigit(ch)){
sum=sum*10+(ch^48);
ch=getchar();
}
return sum*f;
}
il void write(ll x){
if(x<0){
x=-x;
pc('-');
}
if(x>9) write(x/10);
pc(x%10+'0');
}
il void writeln(ll x){
write(x);
enter;
}
il void writesp(ll x){
write(x);
space;
}
}
using namespace my_std;
ll b[100010],res[110000],f[110];
void Bruno(int n,int l,vector<int> A){
fr(i,1,l) b[i]=A[i-1];
f[0]=1;
f[1]=2;
fr(i,2,63) f[i]=f[i-2]+f[i-1];
for(ll i=1,cnt=1;i<=l;i+=44,cnt+=63){
ll rk=0;
fr(j,0,43) if(b[i+j]) rk|=1ll<<j;
pfr(j,63,1){
if(rk>=f[j-1]){
res[cnt+j-1]=1;
rk-=f[j-1];
}
}
}
ll pos=0,lst=0;
fr(i,1,n){
if(res[i]){
pos=i;
break;
}
}
pfr(i,n,1){
if(res[i]){
lst=i;
break;
}
}
fr(i,1,pos-1) Remove(i-1);
fr(i,lst+1,n) Remove(i-1);
ll st=pos+1;
fr(i,pos+1,n){
if(res[i]){
pfr(j,i-1,st) Remove(j-1);
Remove(i-1);
st=i+1;
}
}
Remove(pos-1);
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 100
Accepted
time: 4ms
memory: 3644kb
input:
18 Y X Y Z X Z X X Z Z Y Y Z Y Y Z X X
output:
44 11000100000100000000000000000000000000000000
input:
44 11000100000100000000000000000000000000000000
output:
0 44 3
result:
ok n = 18, D = 44, L = 3
Test #2:
score: 100
Accepted
time: 0ms
memory: 5752kb
input:
18 X Z X Y Y Y X Z X Y Z Z Z Z Y Z Z Y
output:
44 11111001001100000000000000000000000000000000
input:
44 11111001001100000000000000000000000000000000
output:
0 44 3
result:
ok n = 18, D = 44, L = 3
Test #3:
score: 100
Accepted
time: 4ms
memory: 3620kb
input:
18 Y Z Z Y Z X X Z Y Y Z Z Z Y X X Z Y
output:
44 00000011110100000000000000000000000000000000
input:
44 00000011110100000000000000000000000000000000
output:
0 44 2
result:
ok n = 18, D = 44, L = 2
Test #4:
score: 100
Accepted
time: 4ms
memory: 5644kb
input:
18 X Z Z X Z X X Z X Y Y X X Z X Y Z X
output:
44 00010101001100000000000000000000000000000000
input:
44 00010101001100000000000000000000000000000000
output:
0 44 2
result:
ok n = 18, D = 44, 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:
44 01010010010010000000000000000000000000000000
input:
44 01010010010010000000000000000000000000000000
output:
0 44 5
result:
ok n = 18, D = 44, L = 5
Test #6:
score: 100
Accepted
time: 4ms
memory: 5724kb
input:
18 X X Y Z X Y Y Y X X Z X X X Z X Z Z
output:
44 01100011001010000000000000000000000000000000
input:
44 01100011001010000000000000000000000000000000
output:
0 44 2
result:
ok n = 18, D = 44, L = 2
Test #7:
score: 100
Accepted
time: 4ms
memory: 5832kb
input:
3 X Y Z
output:
44 00100000000000000000000000000000000000000000
input:
44 00100000000000000000000000000000000000000000
output:
0 44 1
result:
ok n = 3, D = 44, L = 1
Test #8:
score: 100
Accepted
time: 4ms
memory: 3696kb
input:
3 Z Y X
output:
44 11000000000000000000000000000000000000000000
input:
44 11000000000000000000000000000000000000000000
output:
0 44 0
result:
ok n = 3, D = 44, L = 0
Test #9:
score: 100
Accepted
time: 4ms
memory: 3648kb
input:
18 X X X X X X X X X X X X X X X X X X
output:
44 10000000000000000000000000000000000000000000
input:
44 10000000000000000000000000000000000000000000
output:
0 44 0
result:
ok n = 18, D = 44, L = 0
Test #10:
score: 0
Wrong Answer
time: 4ms
memory: 3648kb
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:
3
result:
wrong answer Wrong Answer [3]
Subtask #2:
score: 0
Wrong Answer
Test #12:
score: 100
Accepted
time: 38ms
memory: 11116kb
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 101001000001111001010010010100010000001110000010100111111100001101101101010101101101001000111001010100111010010000010111101010000110110001110000000110111110111111011110100100010100101000000111101100011101101110110011111001010011001111111000000110110110101000010110111111100001100000111001111001...
input:
69872 101001000001111001010010010100010000001110000010100111111100001101101101010101101101001000111001010100111010010000010111101010000110110001110000000110111110111111011110100100010100101000000111101100011101101110110011111001010011001111111000000110110110101000010110111111100001100000111001111001...
output:
0 69872 22133
result:
points 1.0 n = 100000, D = 69872, L = 22133
Test #13:
score: 100
Accepted
time: 40ms
memory: 11016kb
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:
69872 101101000001011100100001100001000100110001001111110000011000011100000010000110111100110000111111101001111101001110001001011000111110011100100011100000100000101110000000110100101000001001000000011101011100011010111110001100100101011100110111110010111001100110100110000100010110000111001100100011...
input:
69872 101101000001011100100001100001000100110001001111110000011000011100000010000110111100110000111111101001111101001110001001011000111110011100100011100000100000101110000000110100101000001001000000011101011100011010111110001100100101011100110111110010111001100110100110000100010110000111001100100011...
output:
0 69872 22275
result:
points 1.0 n = 100000, D = 69872, L = 22275
Test #14:
score: 0
Wrong Answer
time: 50ms
memory: 11084kb
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:
69872 100101100110000111001001101101000001001001000011000110111111101010011011100111110010001011011001110111001111011011000101010101010000000000111110101110001101010101011011000110001010100011110011010110000111110001100110000111000010010100101101111010110001001000000101100111010010110100001000100111...
input:
69872 100101100110000111001001101101000001001001000011000110111111101010011011100111110010001011011001110111001111011011000101010101010000000000111110101110001101010101011011000110001010100011110011010110000111110001100110000111000010010100101101111010110001001000000101100111010010110100001000100111...
output:
0 69872 11061
result:
wrong answer your query is valid but your solution is not optimal: read 11061 but expected 22177