QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#445999#7637. Exactly Three NeighborswdnmdwrnmmpAC ✓0ms3728kbC++201.3kb2024-06-16 18:45:362024-06-16 18:45:37

Judging History

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

  • [2024-06-16 18:45:37]
  • 评测
  • 测评结果:AC
  • 用时:0ms
  • 内存:3728kb
  • [2024-06-16 18:45:36]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
// #define int long long
#define rep(i,j,k) for(int i=(j);i<=(k);i++)
#define per(i,j,k) for(int i=(j);i>=(k);i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
typedef vector<int> vi;
typedef pair<int,int> pi;

const double eps=1e-9;
signed main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	
	int p,q; cin>>p>>q;
	if((double)p/q>0.8+eps){
		cout<<-1<<' '<<-1<<'\n';
	}
	else if((double)p/q<2.0/3+eps){
		int x=p, y=q*2-p*3;
		cout<<1<<' '<<q*2<<'\n';
		rep(i,1,x){
			cout<<"##.";
		}
		rep(i,1,y){
			cout<<".";
		}
		cout<<endl;
	}
	else if(p==5 && q==7){
		cout<<7<<' '<<6<<'\n';
		cout<<R"(######
...##.
######
###..#
..####
..####
###..# )"<<endl;
	}
	else if(p==7 && q==10){
		cout<<4<<' '<<5<<'\n';
		cout<<R"(.###.
##.##
##.##
.###. )"<<endl;
	}
	else if(p==3 && q==4){
		cout<<4<<' '<<4<<'\n';
		cout<<R"(####
##..
####
..## )"<<endl;
	}
	else if(p==7 && q==9){
		cout<<6<<' '<<18<<'\n';
		cout<<R"(#.##.####.####.###
####.##.####.####.
##.####.##.####.##
.####.####.##.####
###.####.####.##.#
#.####.####.####.# )"<<endl;
	}
	else if(p==4 && q==5){
		cout<<5<<' '<<5<<'\n';
		cout<<R"(#.###
####.
##.##
.####
###.# )"<<endl;
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2 3

output:

1 6
##.##.

result:

ok good solution

Test #2:

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

input:

1 1

output:

-1 -1

result:

ok no solution

Test #3:

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

input:

3 4

output:

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

result:

ok good solution

Test #4:

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

input:

3 5

output:

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

result:

ok good solution

Test #5:

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

input:

4 5

output:

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

result:

ok good solution

Test #6:

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

input:

7 10

output:

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

result:

ok good solution

Test #7:

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

input:

5 7

output:

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

result:

ok good solution

Test #8:

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

input:

7 9

output:

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

result:

ok good solution

Test #9:

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

input:

0 1

output:

1 2
..

result:

ok good solution

Test #10:

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

input:

1 2

output:

1 4
##..

result:

ok good solution

Test #11:

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

input:

1 3

output:

1 6
##....

result:

ok good solution

Test #12:

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

input:

1 4

output:

1 8
##......

result:

ok good solution

Test #13:

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

input:

1 5

output:

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

result:

ok good solution

Test #14:

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

input:

1 6

output:

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

result:

ok good solution

Test #15:

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

input:

1 7

output:

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

result:

ok good solution

Test #16:

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

input:

1 8

output:

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

result:

ok good solution

Test #17:

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

input:

1 9

output:

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

result:

ok good solution

Test #18:

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

input:

1 10

output:

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

result:

ok good solution

Test #19:

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

input:

2 5

output:

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

result:

ok good solution

Test #20:

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

input:

2 7

output:

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

result:

ok good solution

Test #21:

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

input:

2 9

output:

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

result:

ok good solution

Test #22:

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

input:

3 7

output:

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

result:

ok good solution

Test #23:

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

input:

3 8

output:

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

result:

ok good solution

Test #24:

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

input:

3 10

output:

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

result:

ok good solution

Test #25:

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

input:

4 7

output:

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

result:

ok good solution

Test #26:

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

input:

4 9

output:

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

result:

ok good solution

Test #27:

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

input:

5 6

output:

-1 -1

result:

ok no solution

Test #28:

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

input:

5 8

output:

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

result:

ok good solution

Test #29:

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

input:

5 9

output:

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

result:

ok good solution

Test #30:

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

input:

6 7

output:

-1 -1

result:

ok no solution

Test #31:

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

input:

7 8

output:

-1 -1

result:

ok no solution

Test #32:

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

input:

8 9

output:

-1 -1

result:

ok no solution

Test #33:

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

input:

9 10

output:

-1 -1

result:

ok no solution

Extra Test:

score: 0
Extra Test Passed