QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#443006#7637. Exactly Three Neighborszwh2008AC ✓1ms3692kbC++14746b2024-06-15 14:03:312024-06-15 14:03:33

Judging History

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

  • [2024-06-15 14:03:33]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3692kb
  • [2024-06-15 14:03:31]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int p,q;
int main() {
	cin>>p>>q;
	if(3*p<=2*q) {
		if(p&1)p*=2,q*=2;
		cout<<"1 "<<q<<'\n';
		for(int i=1;i<=p/2;i++)cout<<"##.";
		for(int i=1;i<=q-3*p/2;i++)cout<<'.';
		return 0;
	}
	if(p==3&&q==4)cout<<"4 4\n####\n#..#\n####\n.##.\n";
	else if(p==4&&q==5)cout<<"5 5\n#.###\n###.#\n.####\n##.##\n####.\n";
	else if(p==7&&q==10)cout<<"5 4\n..##\n..##\n####\n##..\n####\n";
	else if(p==5&&q==7)cout<<"7 6\n....##\n######\n####..\n#..###\n#..###\n####..\n######\n";
	else if(p==7&&q==9)cout<<"18 6\n..####\n###.##\n#####.\n#..###\n####.#\n.#####\n##..##\n#####.\n#.####\n###..#\n.#####\n##.###\n####..\n#.####\n###.##\n.####.\n##.###\n####.#\n";
	else cout<<"-1 -1\n";
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2 3

output:

1 3
##.

result:

ok good solution

Test #2:

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

input:

1 1

output:

-1 -1

result:

ok no solution

Test #3:

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

input:

3 4

output:

4 4
####
#..#
####
.##.

result:

ok good solution

Test #4:

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

input:

3 5

output:

1 10
##.##.##..

result:

ok good solution

Test #5:

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

input:

4 5

output:

5 5
#.###
###.#
.####
##.##
####.

result:

ok good solution

Test #6:

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

input:

7 10

output:

5 4
..##
..##
####
##..
####

result:

ok good solution

Test #7:

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

input:

5 7

output:

7 6
....##
######
####..
#..###
#..###
####..
######

result:

ok good solution

Test #8:

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

input:

7 9

output:

18 6
..####
###.##
#####.
#..###
####.#
.#####
##..##
#####.
#.####
###..#
.#####
##.###
####..
#.####
###.##
.####.
##.###
####.#

result:

ok good solution

Test #9:

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

input:

0 1

output:

1 1
.

result:

ok good solution

Test #10:

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

input:

1 2

output:

1 4
##..

result:

ok good solution

Test #11:

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

input:

1 3

output:

1 6
##....

result:

ok good solution

Test #12:

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

input:

1 4

output:

1 8
##......

result:

ok good solution

Test #13:

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

input:

1 5

output:

1 10
##........

result:

ok good solution

Test #14:

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

input:

1 6

output:

1 12
##..........

result:

ok good solution

Test #15:

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

input:

1 7

output:

1 14
##............

result:

ok good solution

Test #16:

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

input:

1 8

output:

1 16
##..............

result:

ok good solution

Test #17:

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

input:

1 9

output:

1 18
##................

result:

ok good solution

Test #18:

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

input:

1 10

output:

1 20
##..................

result:

ok good solution

Test #19:

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

input:

2 5

output:

1 5
##...

result:

ok good solution

Test #20:

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

input:

2 7

output:

1 7
##.....

result:

ok good solution

Test #21:

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

input:

2 9

output:

1 9
##.......

result:

ok good solution

Test #22:

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

input:

3 7

output:

1 14
##.##.##......

result:

ok good solution

Test #23:

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

input:

3 8

output:

1 16
##.##.##........

result:

ok good solution

Test #24:

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

input:

3 10

output:

1 20
##.##.##............

result:

ok good solution

Test #25:

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

input:

4 7

output:

1 7
##.##..

result:

ok good solution

Test #26:

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

input:

4 9

output:

1 9
##.##....

result:

ok good solution

Test #27:

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

input:

5 6

output:

-1 -1

result:

ok no solution

Test #28:

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

input:

5 8

output:

1 16
##.##.##.##.##..

result:

ok good solution

Test #29:

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

input:

5 9

output:

1 18
##.##.##.##.##....

result:

ok good solution

Test #30:

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

input:

6 7

output:

-1 -1

result:

ok no solution

Test #31:

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

input:

7 8

output:

-1 -1

result:

ok no solution

Test #32:

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

input:

8 9

output:

-1 -1

result:

ok no solution

Test #33:

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

input:

9 10

output:

-1 -1

result:

ok no solution

Extra Test:

score: 0
Extra Test Passed