QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#20010#3098. Ancient MachineXiao_Luo_Xuan5 60ms9860kbC++201.9kb2022-02-14 15:53:282023-01-17 10:38:56

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:38:56]
  • 评测
  • 测评结果:5
  • 用时:60ms
  • 内存:9860kb
  • [2022-02-14 15:53:28]
  • 提交

Anna

#include<bits/stdc++.h>
#include "Anna.h"
using namespace std;
const int N=1e5+5;

long long fib[66];
void init(){
	fib[0]=1,fib[1]=2;
	for(int i=2;i<=64;i++) fib[i]=fib[i-1]+fib[i-2];
}
bool ans[N];
long long zip(long long x){
	long long tot=0;
	for(int i=0;i<64;i++) if(x>>i & 1ll) tot+=fib[i];
	return tot;
}

void Anna(int n,vector <char> S){
	init();
	for(int i=0;i<n;i++) ans[i]=0;
	int st=-1;
	for(int i=0;i<n;i++){
		if(S[i]=='X'){
			st=i;
			break;
		}
	}
	if(st==-1){
		Send(0);
		return ;
	}
	for(int i=st+1;i<n;i++)
		if(S[i]=='Z' && (i==n-1 || S[i+1]!='Z')) ans[i]=1;
//	for(int i=0;i<n;i++) cout<<ans[i];
//	cout<<endl;
	for(int l=0,r;l<n;l=r+1){
		r=min(n-1,l+63);
		long long tot=0;
		for(int i=l;i<=r;i++) if(ans[i]) tot|=1ll<<(i-l);
		long long x=zip(tot);
		for(int i=0;i<45;i++) Send(x>>i & 1ll);
	}
	for(int i=0;i<17;i++) Send(st>>i & 1ll);
}

Bruno

#include<bits/stdc++.h>
#include "Bruno.h"
using namespace std;
const int N=1e5+5;

bool S[N];
long long fib[66];
void init(){
	fib[0]=1,fib[1]=2;
	for(int i=2;i<=64;i++) fib[i]=fib[i-1]+fib[i-2];
}
long long sol(int x){
	long long tot=0;
	for(int i=64-1;i>=0;i--){
		if(x>=fib[i]) tot|=(1ll<<i),x-=fib[i];
	}
	return tot;
}

void Bruno(int n,int l,vector <int> A){
	init();
	if(l==1){
		for(int i=0;i<n;i++) Remove(i);
		return ;
	}
	int st=0;
	for(int i=l-17;i<l;i++) st |= (A[i]<<(i-l+17));
	
	l-=17;
	for(int i=0;i*45<l;i++){
		long long tot=0;
		for(int t=i*45;t<i*45+45;t++) if(A[t]) tot|=1ll<<(t-i*45);
		long long x=sol(tot);
		for(int t=i*64;t<i*64+64;t++) S[t]=x>>(t-i*64) & 1ll;
	}
	
//	for(int i=0;i<n;i++) cout<<S[i];
//	cout<<endl;
	for(int i=0;i<st;i++) Remove(i);
	int lst=st+1;
	for(int i=st+1;i<n;i++){
		if(S[i]){
			for(int t=i-1;t>=lst;t--) Remove(t);
			Remove(i);
			lst=i+1;
		}
	}
	for(int i=lst;i<n;i++) Remove(i);
	Remove(st);
}

詳細信息

Subtask #1:

score: 5
Accepted

Test #1:

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

input:

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

output:

62
10000100000100000000000000000000000000000000010000000000000000

input:

62
10000100000100000000000000000000000000000000010000000000000000

output:

0 62 3

result:

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

Test #2:

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

input:

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

output:

62
01111001001100000000000000000000000000000000000000000000000000

input:

62
01111001001100000000000000000000000000000000000000000000000000

output:

0 62 3

result:

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

Test #3:

score: 100
Accepted
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:

62
11001101110100000000000000000000000000000000010100000000000000

input:

62
11001101110100000000000000000000000000000000010100000000000000

output:

0 62 2

result:

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

Test #4:

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

input:

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

output:

62
11100101001100000000000000000000000000000000000000000000000000

input:

62
11100101001100000000000000000000000000000000000000000000000000

output:

0 62 2

result:

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

Test #5:

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

input:

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

output:

62
10010010010010000000000000000000000000000000000000000000000000

input:

62
10010010010010000000000000000000000000000000000000000000000000

output:

0 62 5

result:

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

Test #6:

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

input:

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

output:

62
10100011001010000000000000000000000000000000000000000000000000

input:

62
10100011001010000000000000000000000000000000000000000000000000

output:

0 62 2

result:

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

Test #7:

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

input:

3
X Y Z

output:

62
11000000000000000000000000000000000000000000000000000000000000

input:

62
11000000000000000000000000000000000000000000000000000000000000

output:

0 62 1

result:

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

Test #8:

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

input:

3
Z Y X

output:

62
00000000000000000000000000000000000000000000001000000000000000

input:

62
00000000000000000000000000000000000000000000001000000000000000

output:

0 62 0

result:

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

Test #9:

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

input:

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

output:

62
00000000000000000000000000000000000000000000000000000000000000

input:

62
00000000000000000000000000000000000000000000000000000000000000

output:

0 62 0

result:

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

Test #10:

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

input:

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

output:

1
0

input:

1
0

output:

0 1 0

result:

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

Test #11:

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

input:

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

output:

1
0

input:

1
0

output:

0 1 0

result:

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

Subtask #2:

score: 0
Wrong Answer

Test #12:

score: 0
Wrong Answer
time: 60ms
memory: 9860kb

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:

70352
001001000001111001010010010100010000001110000111110110010011010010010110000111001011101000111010010010111101110000110011101001111111010101000001001100110000010010100101110000001000010001010001101010111010100101010101011011000101110101110010011110111111100101011000101100001111000110000010011101...

input:

70352
001001000001111001010010010100010000001110000111110110010011010010010110000111001011101000111010010010111101110000110011101001111111010101000001001100110000010010100101110000001000010001010001101010111010100101010101011011000101110101110010011110111111100101011000101100001111000110000010011101...

output:

0 70352 5254

result:

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