QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#20262 | #3098. Ancient Machine | BuildNoMore | 0 | 62ms | 9948kb | C++14 | 2.0kb | 2022-02-15 10:06:00 | 2023-01-17 10:42:26 |
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]=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);
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 100
Accepted
time: 4ms
memory: 3768kb
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: 3620kb
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: 0
Wrong Answer
time: 4ms
memory: 3792kb
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 1
result:
wrong answer your query is valid but your solution is not optimal: read 1 but expected 2
Subtask #2:
score: 0
Wrong Answer
Test #12:
score: 0
Wrong Answer
time: 62ms
memory: 9948kb
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