QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#20271#3098. Ancient MachineBuildNoMore5 40ms10056kbC++142.0kb2022-02-15 10:40:112023-01-17 10:42:54

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-01-17 10:42:54]
  • 评测
  • 测评结果:5
  • 用时:40ms
  • 内存:10056kb
  • [2022-02-15 10:40:11]
  • 提交

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+64);lon x=0,tot=0;
			rep(j,l,r)if(is[j])x|=( 1ll<<(j-l) );
			per(j,64,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);
		int poi=wei;
		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,64,0){
				if(tot>=f[j])x|=(1llu<<j),tot-=f[j];
			}
			int r2=min(n-1,poi+64);
			rep(j,poi,r2){
				if( x&( 1ll<<(j-poi) ) )b[j+1]=1;
			}
			i=r,poi=r2+1;
		}
		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);
	}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 5
Accepted

Test #1:

score: 100
Accepted
time: 4ms
memory: 3788kb

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: 3716kb

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: 100
Accepted
time: 0ms
memory: 3616kb

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 2

result:

ok n = 18, D = 61, L = 2

Test #4:

score: 100
Accepted
time: 4ms
memory: 3712kb

input:

18
X Z Z X Z X X Z X Y Y X X Z X Y Z X

output:

61
0000000000000000010010111110000000000000000000000000000000000

input:

61
0000000000000000010010111110000000000000000000000000000000000

output:

0 61 2

result:

ok n = 18, D = 61, L = 2

Test #5:

score: 100
Accepted
time: 4ms
memory: 3716kb

input:

18
X Y X Y Y X X Z Y Z Y X Z Y Y X X Z

output:

61
0000000000000000101100101101000000000000000000000000000000000

input:

61
0000000000000000101100101101000000000000000000000000000000000

output:

0 61 5

result:

ok n = 18, D = 61, L = 5

Test #6:

score: 100
Accepted
time: 4ms
memory: 3732kb

input:

18
X X Y Z X Y Y Y X X Z X X X Z X Z Z

output:

61
0000000000000000011010110011000000000000000000000000000000000

input:

61
0000000000000000011010110011000000000000000000000000000000000

output:

0 61 2

result:

ok n = 18, D = 61, L = 2

Test #7:

score: 100
Accepted
time: 4ms
memory: 3640kb

input:

3
X Y Z

output:

61
0000000000000000010000000000000000000000000000000000000000000

input:

61
0000000000000000010000000000000000000000000000000000000000000

output:

0 61 1

result:

ok n = 3, D = 61, L = 1

Test #8:

score: 100
Accepted
time: 4ms
memory: 3712kb

input:

3
Z Y X

output:

16
0100000000000000

input:

16
0100000000000000

output:

0 16 0

result:

ok n = 3, D = 16, L = 0

Test #9:

score: 100
Accepted
time: 4ms
memory: 3596kb

input:

18
X X X X X X X X X X X X X X X X X X

output:

61
0000000000000000000000000000000000000000000000000000000000000

input:

61
0000000000000000000000000000000000000000000000000000000000000

output:

0 61 0

result:

ok n = 18, D = 61, L = 0

Test #10:

score: 100
Accepted
time: 0ms
memory: 3704kb

input:

18
Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y

output:

16
1111111111111111

input:

16
1111111111111111

output:

0 16 0

result:

ok n = 18, D = 16, L = 0

Test #11:

score: 100
Accepted
time: 4ms
memory: 3692kb

input:

18
Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z

output:

16
1111111111111111

input:

16
1111111111111111

output:

0 16 0

result:

ok n = 18, D = 16, L = 0

Subtask #2:

score: 0
Wrong Answer

Test #12:

score: 0
Wrong Answer
time: 40ms
memory: 10056kb

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:

69271
000000000000000001100001010011110011000101101100101010001000011100011111100001000010100100000010111010000101001001000001010010000010001011000011100100111000111101111111000101011111101100001011011000101000100010000001101111010000011010010100011110000001100100001111001110110110110010001010001111...

input:

69271
000000000000000001100001010011110011000101101100101010001000011100011111100001000010100100000010111010000101001001000001010010000010001011000011100100111000111101111111000101011111101100001011011000101000100010000001101111010000011010010100011110000001100100001111001110110110110010001010001111...

output:

0 69271 21727

result:

wrong answer your query is valid but your solution is not optimal: read 21727 but expected 22133