QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#20349#3098. Ancient Machine2018ty22#5 6ms3216kbC++202.7kb2022-02-15 19:33:062023-01-17 10:44:04

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:44:04]
  • 评测
  • 测评结果:5
  • 用时:6ms
  • 内存:3216kb
  • [2022-02-15 19:33:06]
  • 提交

Anna

#include<cstdio>
#include<vector>
using namespace std;
void Send(int a);
typedef unsigned long long ll;
int max(int a,int b){return a>b?a:b;}
const ll INF=0x8000000000000000ll;
struct node{
	int len;
	ll h[2001];
	node(){len=0;}
	node(int x,ll y){len=x;h[0]=y;}
	void operator=(ll y){len=1;h[0]=y;}
	void operator+=(const node&y){
		len=max(len,y.len);
		bool jw=0;
		for(int i=0;i<len;++i)
		{
			h[i]+=jw+y.h[i];
			if(h[i]>=INF)h[i]^=INF,jw=true;
			else jw=false;
		}
		if(jw)h[len++]=1llu;
	}
	void operator-=(const node&y){
		bool jw=0;
		for(int i=0;i<len;++i)
		{
			h[i]-=y.h[i]+jw;
			if(h[i]>=INF)h[i]^=INF,jw=true;
			else jw=false;
		}
		if(!h[len-1])--len;
	}
};
void Anna(int N,vector<char> S)
{
	int lst=-1;
	for(int i=N-1;~i;--i)
		if(S[i]=='Z')
		{
			lst=i;
			for(int j=0;j<17;++j)Send((i&(1<<j))>0);
			break;
		}
	if(lst<0)
	{
		Send(1);return;
	}
	node ans,vp[2]={};
	vp[0]=1;vp[1]=1;
	for(int i=0;i<lst;++i)
	{
		if(S[i]=='X'&&(!i||S[i-1]!='X'))ans+=vp[i&1];
		vp[~i&1]+=vp[i&1];
	}
	for(int i=0;i<ans.len;++i)
		for(ll j=0;j<63;++j)
			Send(bool(ans.h[i]&(1llu<<j)));
}

Bruno

#include<cstdio>
#include<vector>
using namespace std;
void Remove(int d);
typedef unsigned long long ll;
int max(int a,int b){return a>b?a:b;}
const ll INF=0x8000000000000000ll;
struct node{
	int len;
	ll h[2001];
	node(){len=0;}
	node(int x,ll y){len=x;h[0]=y;}
	void operator=(ll y){len=1;h[0]=y;}
	void operator+=(const node&y){
		len=max(len,y.len);
		bool jw=0;
		for(int i=0;i<len;++i)
		{
			h[i]+=jw+y.h[i];
			if(h[i]>=INF)h[i]^=INF,jw=true;
			else jw=false;
		}
		if(jw)h[len++]=1llu;
	}
	void operator-=(const node&y){
		bool jw=0;
		for(int i=0;i<len;++i)
		{
			h[i]-=y.h[i]+jw;
			if(h[i]>=INF)h[i]^=INF,jw=true;
			else jw=false;
		}
		if(!h[len-1])--len;
	}
	bool operator<(const node&y)const{
		if(len!=y.len)return len<y.len;
		for(int i=len-1;~i;--i)if(h[i]!=y.h[i])return h[i]<y.h[i];
		return false;
	}
	bool operator<=(const node&y)const{
		return!(y<*this);
	}
};
void Bruno(int N,int L,vector<int> A)
{
	if(L<17){
		for(int i=0;i<N;++i)Remove(i);
		return;
	}
	static bool us[100001]={};
	int lst=0,lp;
	for(int i=0;i<17;++i)
		lst|=A[i]<<i;
	node ans,vp[2]={};
	ans.len=L/63;
	for(int i=17;i<L;++i)
		if(A[i])
			ans.h[(i-17)/63]|=1llu<<ll((i-17)%63);
	vp[0]=1llu;vp[1]=1llu;
	for(int i=0;i<lst;++i)
		vp[~i&1]+=vp[i&1];
	for(int i=lst-1;~i;--i)
	{
		vp[~i&1]-=vp[i&1];
		if(vp[i&1]<=ans)ans-=vp[i&1],us[i]=true;
	}
	lp=lst;
	for(int i=lst+1;i<N;++i)Remove(i);
	for(int i=lp-1;~i;--i)
		if(us[i])
		{
			for(int j=i+1;j<lst;++j)Remove(j);
			Remove(i);
			lst=i;
		}
	for(int i=0;i<lst;++i)Remove(i);
	Remove(lp);
}

詳細信息

Subtask #1:

score: 5
Accepted

Test #1:

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

input:

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

output:

80
11110000000000000111110000000000000000000000000000000000000000000000000000000000

input:

80
11110000000000000111110000000000000000000000000000000000000000000000000000000000

output:

0 80 3

result:

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

Test #2:

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

input:

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

output:

80
00001000000000000000010100000000000000000000000000000000000000000000000000000000

input:

80
00001000000000000000010100000000000000000000000000000000000000000000000000000000

output:

0 80 3

result:

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

Test #3:

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

input:

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

output:

80
00001000000000000000101111100000000000000000000000000000000000000000000000000000

input:

80
00001000000000000000101111100000000000000000000000000000000000000000000000000000

output:

0 80 2

result:

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

Test #4:

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

input:

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

output:

80
00001000000000000011100001010000000000000000000000000000000000000000000000000000

input:

80
00001000000000000011100001010000000000000000000000000000000000000000000000000000

output:

0 80 2

result:

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

Test #5:

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

input:

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

output:

80
10001000000000000111011001110000000000000000000000000000000000000000000000000000

input:

80
10001000000000000111011001110000000000000000000000000000000000000000000000000000

output:

0 80 5

result:

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

Test #6:

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

input:

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

output:

80
10001000000000000011001101110000000000000000000000000000000000000000000000000000

input:

80
10001000000000000011001101110000000000000000000000000000000000000000000000000000

output:

0 80 2

result:

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

Test #7:

score: 100
Accepted
time: 6ms
memory: 3176kb

input:

3
X Y Z

output:

80
01000000000000000100000000000000000000000000000000000000000000000000000000000000

input:

80
01000000000000000100000000000000000000000000000000000000000000000000000000000000

output:

0 80 1

result:

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

Test #8:

score: 100
Accepted
time: 2ms
memory: 3212kb

input:

3
Z Y X

output:

17
00000000000000000

input:

17
00000000000000000

output:

0 17 0

result:

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

Test #9:

score: 100
Accepted
time: 2ms
memory: 3176kb

input:

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

output:

1
1

input:

1
1

output:

0 1 0

result:

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

Test #10:

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

input:

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

output:

1
1

input:

1
1

output:

0 1 0

result:

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

Test #11:

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

input:

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

output:

17
10001000000000000

input:

17
10001000000000000

output:

0 17 0

result:

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

Subtask #2:

score: 0
Programme Bruno Runtime Error

Test #12:

score: 0
Programme Bruno Runtime Error

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:

69443
101110010110000110111111111110111001110011100010011111111101101010010011110000000011000101001100001111000011001001101111001111010001011010111010010111111000001100101010001101100100100111110001111010001000101111011011010101010101010101011011001011000101100010100011110010110010010000000011110101...

input:


output:


result: