QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#20063#3098. Ancient Machineguobo#5 58ms10752kbC++142.1kb2022-02-14 17:06:432023-01-17 10:40:27

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:40:27]
  • 评测
  • 测评结果:5
  • 用时:58ms
  • 内存:10752kb
  • [2022-02-14 17:06:43]
  • 提交

Anna

#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const int maxn=111111,mod=998244353;
#define MP make_pair
#define PB push_back
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define ROF(i,a,b) for(int i=(a);i>=(b);i--)
#define MEM(x,v) memset(x,v,sizeof(x))
inline int qpow(int a,int b){
	int ans=1;
	for(;b;b>>=1,a=1ll*a*a%mod) if(b&1) ans=1ll*ans*a%mod;
	return ans;
}
void Anna(int N,vector<char> S){
	vector<int> v;
	bool flag=false;
	FOR(i,0,N-1){
		if(!flag){
			if(S[i]=='X') flag=true,v.PB(1);
			v.PB(0);
		}
		else{
			if(S[i]=='Z' && (i==N-1 || S[i+1]!='Z')) v.PB(1);
			else v.PB(0);
		}
	}
//	FOR(i,0,N) printf("%d",v[i]);
//	puts("");
	while(v.size()%63) v.PB(0);
	ll f[maxn];
	f[1]=1;
	FOR(i,2,65) f[i]=f[i-1]+f[i-2];
	FOR(i,0,(int)v.size()/63-1){
		ll s=0;
		int lst=-1;
		FOR(j,0,62){
			int x=v[i*63+j];
			if(!x){
				if(lst!=j-1) s+=f[64-j];
				lst=j;
			}
		}
		if(lst!=62) s+=f[1];
		FOR(j,0,43) Send((s>>j)&1);
	}
}

Bruno

#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const int maxn=111111,mod=998244353;
#define MP make_pair
#define PB push_back
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define ROF(i,a,b) for(int i=(a);i>=(b);i--)
#define MEM(x,v) memset(x,v,sizeof(x))
inline int qpow(int a,int b){
	int ans=1;
	for(;b;b>>=1,a=1ll*a*a%mod) if(b&1) ans=1ll*ans*a%mod;
	return ans;
}
void Bruno(int N,int L,vector<int> A){
	vector<int> v,vv;
	ll f[maxn];
	f[1]=1;
	FOR(i,2,65) f[i]=f[i-1]+f[i-2];
	FOR(i,0,L/44-1){
		ll s=0;
		FOR(j,0,43) s|=(ll)A[i*44+j]<<j;
		int lst=-1;
		FOR(j,1,62){
			if(s>=f[64-j]) s-=f[64-j],v.PB(1),v.PB(0),j++;
			else v.PB(0);
		}
		if(s) v.back()=1;
	}
	int lst=-1;
	FOR(i,0,N) if(v[i]){
		FOR(j,0,i) vv.PB(v[j]);
		FOR(j,i+2,N) vv.PB(v[j]);
		break;
	}
	v=vv;
	FOR(i,0,N){
		if(i==N || v[i]){
			ROF(j,i-1,lst+1) Remove(j);
			if(lst==-1) lst=i;
			else{
				lst=i;
				if(i!=N) Remove(i);
			}
		}
	}
	FOR(i,0,N) if(v[i]){Remove(i);break;}
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 5
Accepted

Test #1:

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

input:

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

output:

44
11011010001010111100000001011110110011110010

input:

44
11011010001010111100000001011110110011110010

output:

0 44 3

result:

ok n = 18, D = 44, L = 3

Test #2:

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

input:

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

output:

44
00011000100110111001110001001101000001100001

input:

44
00011000100110111001110001001101000001100001

output:

0 44 3

result:

ok n = 18, D = 44, L = 3

Test #3:

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

input:

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

output:

44
00100000010010101111011101100001101101010000

input:

44
00100000010010101111011101100001101101010000

output:

0 44 2

result:

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

Test #4:

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

input:

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

output:

44
01101110111111011010100100111001110100000001

input:

44
01101110111111011010100100111001110100000001

output:

0 44 2

result:

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

Test #5:

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

input:

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

output:

44
11101011011110011110001011000111011001000110

input:

44
11101011011110011110001011000111011001000110

output:

0 44 5

result:

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

Test #6:

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

input:

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

output:

44
00000011011001110100000011101001011110110110

input:

44
00000011011001110100000011101001011110110110

output:

0 44 2

result:

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

Test #7:

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

input:

3
X Y Z

output:

44
01001101111011101100110000101100111110101110

input:

44
01001101111011101100110000101100111110101110

output:

0 44 1

result:

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

Test #8:

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

input:

3
Z Y X

output:

44
10010000100101010110100110110100111000100100

input:

44
10010000100101010110100110110100111000100100

output:

0 44 0

result:

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

Test #9:

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

input:

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

output:

44
01000111001001100000110111100011011011111010

input:

44
01000111001001100000110111100011011011111010

output:

0 44 0

result:

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

Test #10:

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

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:

0 44 0

result:

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

Test #11:

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

input:

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

output:

44
00000000000000000000000000000000000000000000

input:

44
00000000000000000000000000000000000000000000

output:

0 44 0

result:

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

Subtask #2:

score: 0
Wrong Answer

Test #12:

score: 0
Wrong Answer
time: 58ms
memory: 10752kb

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
011100110000101011011011110000011001011100011010011101000110111011111010111001000110000000010000000010000101010001011100010001001000010010001110011100010101001001111001010101001100011010101111100100101101100011100011000010110111000001101001101111000111111100000010001111010000000101011001011100...

input:

69872
011100110000101011011011110000011001011100011010011101000110111011111010111001000110000000010000000010000101010001011100010001001000010010001110011100010101001001111001010101001100011010101111100100101101100011100011000010110111000001101001101111000111111100000010001111010000000101011001011100...

output:

0 69872 6856

result:

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