QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#54553#4237. Word LadderYL1F4#AC ✓7ms14728kbC++1.5kb2022-10-09 17:25:182022-10-09 17:25:19

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-10-09 17:25:19]
  • 评测
  • 测评结果:AC
  • 用时:7ms
  • 内存:14728kb
  • [2022-10-09 17:25:18]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int n,a[20],tagdbx,tagfbx;
string s[26*26*26*2*10+10];
void init(){
	s[1]="aaaaaa";
	int cnt=2;
	for(int i=2;i<=26;i++){
		s[cnt]=s[cnt-1];
		s[cnt][0]=i+'a'-1;
		cnt++;
		s[cnt]=s[cnt-1];
		s[cnt][1]=i+'a'-1;
		cnt++;
		for(int j=2;j<=26;j++){
			if((i%2)+j==26){
				//cout<<j<<' '<<k<<' '<<s[cnt-1]<<'\n';
				continue;
			}
			s[cnt]=s[cnt-1];
			s[cnt][2]=j+'a'-1;
			cnt++;
			s[cnt]=s[cnt-1];
			s[cnt][3]=j+'a'-1;
			cnt++;
			if(s[cnt-1]=="ddbbxx"){
					//cout<<"nmsl";
					if(tagdbx){
					cnt-=2;
					continue;
				}
				tagdbx=1;
			}
			if(s[cnt-1]=="ffbbxx"){
					//cout<<"nmsl";
					if(tagfbx){
						cnt-=2;
						continue;
					}
					tagfbx=1;
				}
			for(int k=2;k<=26;k++){
				if(((i%2)^1)+j==26&&((i%2)^(j%2))+k==26){
					continue;
				}else if((j%2)+k==26){
					//cout<<j<<' '<<k<<' '<<s[cnt-1]<<'\n';
					continue;
				}
				s[cnt]=s[cnt-1];
				s[cnt][4]=k+'a'-1;
				cnt++;
				s[cnt]=s[cnt-1];
				s[cnt][5]=k+'a'-1;
				cnt++;
				if(s[cnt-1]=="ddbbxx"){
					//cout<<"nmsl";
					if(tagdbx){
						cnt-=2;
						continue;
					}
					tagdbx=1;
				}
				if(s[cnt-1]=="ffbbxx"){
					//cout<<"nmsl";
					if(tagfbx){
						cnt-=2;
						continue;
					}
					tagfbx=1;
				}
			}
			
		}
	}
}
int main(){
	//freopen("m.in","w",stdout);
	init();
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	cin>>n;
	for(int i=1;i<=n;i++){
		cout<<s[i]<<'\n';
	}
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 14640kb

input:

5

output:

aaaaaa
baaaaa
bbaaaa
bbbaaa
bbbbaa

result:

ok good solution

Test #2:

score: 0
Accepted
time: 6ms
memory: 14544kb

input:

3

output:

aaaaaa
baaaaa
bbaaaa

result:

ok good solution

Test #3:

score: 0
Accepted
time: 5ms
memory: 14620kb

input:

4

output:

aaaaaa
baaaaa
bbaaaa
bbbaaa

result:

ok good solution

Test #4:

score: 0
Accepted
time: 2ms
memory: 14676kb

input:

6

output:

aaaaaa
baaaaa
bbaaaa
bbbaaa
bbbbaa
bbbbba

result:

ok good solution

Test #5:

score: 0
Accepted
time: 5ms
memory: 14548kb

input:

7

output:

aaaaaa
baaaaa
bbaaaa
bbbaaa
bbbbaa
bbbbba
bbbbbb

result:

ok good solution

Test #6:

score: 0
Accepted
time: 2ms
memory: 14676kb

input:

8

output:

aaaaaa
baaaaa
bbaaaa
bbbaaa
bbbbaa
bbbbba
bbbbbb
bbbbcb

result:

ok good solution

Test #7:

score: 0
Accepted
time: 5ms
memory: 14640kb

input:

9

output:

aaaaaa
baaaaa
bbaaaa
bbbaaa
bbbbaa
bbbbba
bbbbbb
bbbbcb
bbbbcc

result:

ok good solution

Test #8:

score: 0
Accepted
time: 2ms
memory: 14592kb

input:

10

output:

aaaaaa
baaaaa
bbaaaa
bbbaaa
bbbbaa
bbbbba
bbbbbb
bbbbcb
bbbbcc
bbbbdc

result:

ok good solution

Test #9:

score: 0
Accepted
time: 5ms
memory: 14512kb

input:

64

output:

aaaaaa
baaaaa
bbaaaa
bbbaaa
bbbbaa
bbbbba
bbbbbb
bbbbcb
bbbbcc
bbbbdc
bbbbdd
bbbbed
bbbbee
bbbbfe
bbbbff
bbbbgf
bbbbgg
bbbbhg
bbbbhh
bbbbih
bbbbii
bbbbji
bbbbjj
bbbbkj
bbbbkk
bbbblk
bbbbll
bbbbml
bbbbmm
bbbbnm
bbbbnn
bbbbon
bbbboo
bbbbpo
bbbbpp
bbbbqp
bbbbqq
bbbbrq
bbbbrr
bbbbsr
bbbbss
bbbbts
bbbbtt...

result:

ok good solution

Test #10:

score: 0
Accepted
time: 5ms
memory: 14620kb

input:

51

output:

aaaaaa
baaaaa
bbaaaa
bbbaaa
bbbbaa
bbbbba
bbbbbb
bbbbcb
bbbbcc
bbbbdc
bbbbdd
bbbbed
bbbbee
bbbbfe
bbbbff
bbbbgf
bbbbgg
bbbbhg
bbbbhh
bbbbih
bbbbii
bbbbji
bbbbjj
bbbbkj
bbbbkk
bbbblk
bbbbll
bbbbml
bbbbmm
bbbbnm
bbbbnn
bbbbon
bbbboo
bbbbpo
bbbbpp
bbbbqp
bbbbqq
bbbbrq
bbbbrr
bbbbsr
bbbbss
bbbbts
bbbbtt...

result:

ok good solution

Test #11:

score: 0
Accepted
time: 6ms
memory: 14592kb

input:

97

output:

aaaaaa
baaaaa
bbaaaa
bbbaaa
bbbbaa
bbbbba
bbbbbb
bbbbcb
bbbbcc
bbbbdc
bbbbdd
bbbbed
bbbbee
bbbbfe
bbbbff
bbbbgf
bbbbgg
bbbbhg
bbbbhh
bbbbih
bbbbii
bbbbji
bbbbjj
bbbbkj
bbbbkk
bbbblk
bbbbll
bbbbml
bbbbmm
bbbbnm
bbbbnn
bbbbon
bbbboo
bbbbpo
bbbbpp
bbbbqp
bbbbqq
bbbbrq
bbbbrr
bbbbsr
bbbbss
bbbbts
bbbbtt...

result:

ok good solution

Test #12:

score: 0
Accepted
time: 5ms
memory: 14520kb

input:

100

output:

aaaaaa
baaaaa
bbaaaa
bbbaaa
bbbbaa
bbbbba
bbbbbb
bbbbcb
bbbbcc
bbbbdc
bbbbdd
bbbbed
bbbbee
bbbbfe
bbbbff
bbbbgf
bbbbgg
bbbbhg
bbbbhh
bbbbih
bbbbii
bbbbji
bbbbjj
bbbbkj
bbbbkk
bbbblk
bbbbll
bbbbml
bbbbmm
bbbbnm
bbbbnn
bbbbon
bbbboo
bbbbpo
bbbbpp
bbbbqp
bbbbqq
bbbbrq
bbbbrr
bbbbsr
bbbbss
bbbbts
bbbbtt...

result:

ok good solution

Test #13:

score: 0
Accepted
time: 2ms
memory: 14596kb

input:

1000

output:

aaaaaa
baaaaa
bbaaaa
bbbaaa
bbbbaa
bbbbba
bbbbbb
bbbbcb
bbbbcc
bbbbdc
bbbbdd
bbbbed
bbbbee
bbbbfe
bbbbff
bbbbgf
bbbbgg
bbbbhg
bbbbhh
bbbbih
bbbbii
bbbbji
bbbbjj
bbbbkj
bbbbkk
bbbblk
bbbbll
bbbbml
bbbbmm
bbbbnm
bbbbnn
bbbbon
bbbboo
bbbbpo
bbbbpp
bbbbqp
bbbbqq
bbbbrq
bbbbrr
bbbbsr
bbbbss
bbbbts
bbbbtt...

result:

ok good solution

Test #14:

score: 0
Accepted
time: 6ms
memory: 14728kb

input:

1001

output:

aaaaaa
baaaaa
bbaaaa
bbbaaa
bbbbaa
bbbbba
bbbbbb
bbbbcb
bbbbcc
bbbbdc
bbbbdd
bbbbed
bbbbee
bbbbfe
bbbbff
bbbbgf
bbbbgg
bbbbhg
bbbbhh
bbbbih
bbbbii
bbbbji
bbbbjj
bbbbkj
bbbbkk
bbbblk
bbbbll
bbbbml
bbbbmm
bbbbnm
bbbbnn
bbbbon
bbbboo
bbbbpo
bbbbpp
bbbbqp
bbbbqq
bbbbrq
bbbbrr
bbbbsr
bbbbss
bbbbts
bbbbtt...

result:

ok good solution

Test #15:

score: 0
Accepted
time: 5ms
memory: 14564kb

input:

1024

output:

aaaaaa
baaaaa
bbaaaa
bbbaaa
bbbbaa
bbbbba
bbbbbb
bbbbcb
bbbbcc
bbbbdc
bbbbdd
bbbbed
bbbbee
bbbbfe
bbbbff
bbbbgf
bbbbgg
bbbbhg
bbbbhh
bbbbih
bbbbii
bbbbji
bbbbjj
bbbbkj
bbbbkk
bbbblk
bbbbll
bbbbml
bbbbmm
bbbbnm
bbbbnn
bbbbon
bbbboo
bbbbpo
bbbbpp
bbbbqp
bbbbqq
bbbbrq
bbbbrr
bbbbsr
bbbbss
bbbbts
bbbbtt...

result:

ok good solution

Test #16:

score: 0
Accepted
time: 2ms
memory: 14592kb

input:

1025

output:

aaaaaa
baaaaa
bbaaaa
bbbaaa
bbbbaa
bbbbba
bbbbbb
bbbbcb
bbbbcc
bbbbdc
bbbbdd
bbbbed
bbbbee
bbbbfe
bbbbff
bbbbgf
bbbbgg
bbbbhg
bbbbhh
bbbbih
bbbbii
bbbbji
bbbbjj
bbbbkj
bbbbkk
bbbblk
bbbbll
bbbbml
bbbbmm
bbbbnm
bbbbnn
bbbbon
bbbboo
bbbbpo
bbbbpp
bbbbqp
bbbbqq
bbbbrq
bbbbrr
bbbbsr
bbbbss
bbbbts
bbbbtt...

result:

ok good solution

Test #17:

score: 0
Accepted
time: 0ms
memory: 14576kb

input:

5000

output:

aaaaaa
baaaaa
bbaaaa
bbbaaa
bbbbaa
bbbbba
bbbbbb
bbbbcb
bbbbcc
bbbbdc
bbbbdd
bbbbed
bbbbee
bbbbfe
bbbbff
bbbbgf
bbbbgg
bbbbhg
bbbbhh
bbbbih
bbbbii
bbbbji
bbbbjj
bbbbkj
bbbbkk
bbbblk
bbbbll
bbbbml
bbbbmm
bbbbnm
bbbbnn
bbbbon
bbbboo
bbbbpo
bbbbpp
bbbbqp
bbbbqq
bbbbrq
bbbbrr
bbbbsr
bbbbss
bbbbts
bbbbtt...

result:

ok good solution

Test #18:

score: 0
Accepted
time: 7ms
memory: 14600kb

input:

4999

output:

aaaaaa
baaaaa
bbaaaa
bbbaaa
bbbbaa
bbbbba
bbbbbb
bbbbcb
bbbbcc
bbbbdc
bbbbdd
bbbbed
bbbbee
bbbbfe
bbbbff
bbbbgf
bbbbgg
bbbbhg
bbbbhh
bbbbih
bbbbii
bbbbji
bbbbjj
bbbbkj
bbbbkk
bbbblk
bbbbll
bbbbml
bbbbmm
bbbbnm
bbbbnn
bbbbon
bbbboo
bbbbpo
bbbbpp
bbbbqp
bbbbqq
bbbbrq
bbbbrr
bbbbsr
bbbbss
bbbbts
bbbbtt...

result:

ok good solution

Test #19:

score: 0
Accepted
time: 1ms
memory: 14544kb

input:

4096

output:

aaaaaa
baaaaa
bbaaaa
bbbaaa
bbbbaa
bbbbba
bbbbbb
bbbbcb
bbbbcc
bbbbdc
bbbbdd
bbbbed
bbbbee
bbbbfe
bbbbff
bbbbgf
bbbbgg
bbbbhg
bbbbhh
bbbbih
bbbbii
bbbbji
bbbbjj
bbbbkj
bbbbkk
bbbblk
bbbbll
bbbbml
bbbbmm
bbbbnm
bbbbnn
bbbbon
bbbboo
bbbbpo
bbbbpp
bbbbqp
bbbbqq
bbbbrq
bbbbrr
bbbbsr
bbbbss
bbbbts
bbbbtt...

result:

ok good solution

Test #20:

score: 0
Accepted
time: 7ms
memory: 14620kb

input:

4097

output:

aaaaaa
baaaaa
bbaaaa
bbbaaa
bbbbaa
bbbbba
bbbbbb
bbbbcb
bbbbcc
bbbbdc
bbbbdd
bbbbed
bbbbee
bbbbfe
bbbbff
bbbbgf
bbbbgg
bbbbhg
bbbbhh
bbbbih
bbbbii
bbbbji
bbbbjj
bbbbkj
bbbbkk
bbbblk
bbbbll
bbbbml
bbbbmm
bbbbnm
bbbbnn
bbbbon
bbbboo
bbbbpo
bbbbpp
bbbbqp
bbbbqq
bbbbrq
bbbbrr
bbbbsr
bbbbss
bbbbts
bbbbtt...

result:

ok good solution

Test #21:

score: 0
Accepted
time: 2ms
memory: 14580kb

input:

4098

output:

aaaaaa
baaaaa
bbaaaa
bbbaaa
bbbbaa
bbbbba
bbbbbb
bbbbcb
bbbbcc
bbbbdc
bbbbdd
bbbbed
bbbbee
bbbbfe
bbbbff
bbbbgf
bbbbgg
bbbbhg
bbbbhh
bbbbih
bbbbii
bbbbji
bbbbjj
bbbbkj
bbbbkk
bbbblk
bbbbll
bbbbml
bbbbmm
bbbbnm
bbbbnn
bbbbon
bbbboo
bbbbpo
bbbbpp
bbbbqp
bbbbqq
bbbbrq
bbbbrr
bbbbsr
bbbbss
bbbbts
bbbbtt...

result:

ok good solution

Test #22:

score: 0
Accepted
time: 2ms
memory: 14512kb

input:

3751

output:

aaaaaa
baaaaa
bbaaaa
bbbaaa
bbbbaa
bbbbba
bbbbbb
bbbbcb
bbbbcc
bbbbdc
bbbbdd
bbbbed
bbbbee
bbbbfe
bbbbff
bbbbgf
bbbbgg
bbbbhg
bbbbhh
bbbbih
bbbbii
bbbbji
bbbbjj
bbbbkj
bbbbkk
bbbblk
bbbbll
bbbbml
bbbbmm
bbbbnm
bbbbnn
bbbbon
bbbboo
bbbbpo
bbbbpp
bbbbqp
bbbbqq
bbbbrq
bbbbrr
bbbbsr
bbbbss
bbbbts
bbbbtt...

result:

ok good solution