QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#514029#7637. Exactly Three NeighborsDinalAC ✓0ms3948kbC++142.3kb2024-08-10 21:17:022024-08-10 21:17:02

Judging History

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

  • [2024-08-10 21:17:02]
  • 评测
  • 测评结果:AC
  • 用时:0ms
  • 内存:3948kb
  • [2024-08-10 21:17:02]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
template<typename T>
void read(T &a){
    #define gc getchar()
    char c;a=0;int f=1;
    while(!isdigit(c=gc))if(c=='-')f=-1;
    do a=a*10+c-'0';
    while(isdigit(c=gc));
    a*=f;
}
template<typename T>
void write(T a){
    if(a<0)putchar('-'),a=-a;
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> PII;
typedef pair<ll,int> PLI;
mt19937 eg;
int p,q;
int main(){
    eg.seed(chrono::system_clock::now().time_since_epoch().count());
    cin>>p>>q;
    int g=__gcd(p,q);
    p/=g,q/=g;
    if(3*p<=2*q){
        p*=2,q*=2;
        printf("1 %d\n",q);
        int a=p/2,b=q-p;
        for(int i=1;i<=a;++i)printf(".##");
        for(int i=1;i<=b-a;++i)printf(".");
        puts("");
    }else{
        if(p==3&&q==4){
            printf("4 4\n");
            puts("##..");
            puts("####");
            puts("..##");
            puts("####");
        }else if(p==4&&q==5){
            printf("5 5\n");
            puts("###.#");
            puts("#.###");
            puts("####.");
            puts("##.##");
            puts(".####");
        }else if(p==7&&q==10){
            printf("5 4\n");
            puts("##..");
            puts("####");
            puts("..##");
            puts("####");
            puts("##..");
        }else if(p==5&&q==7){
            printf("7 6\n");
            puts("...##.");
            puts("######");
            puts("###..#");
            puts("..####");
            puts("..####");
            puts("###..#");
            puts("######");
        }else if(p==7&&q==9){
            puts("18 6");
            puts("##.###");
            puts(".####.");
            puts("###.##");
            puts("#.####");
            puts("####..");
            puts("##.###");
            puts(".#####");
            puts("###..#");
            puts("#.####");
            puts("#####.");
            puts("##..##");
            puts(".#####");
            puts("####.#");
            puts("#..###");
            puts("#####.");
            puts("###.##");
            puts("..####");
            puts("####.#");
        }else{
            puts("-1 -1");
        }
    }
    return 0;
}

詳細信息

Test #1:

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

input:

2 3

output:

1 6
.##.##

result:

ok good solution

Test #2:

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

input:

1 1

output:

-1 -1

result:

ok no solution

Test #3:

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

input:

3 4

output:

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

result:

ok good solution

Test #4:

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

input:

3 5

output:

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

result:

ok good solution

Test #5:

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

input:

4 5

output:

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

result:

ok good solution

Test #6:

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

input:

7 10

output:

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

result:

ok good solution

Test #7:

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

input:

5 7

output:

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

result:

ok good solution

Test #8:

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

input:

7 9

output:

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

result:

ok good solution

Test #9:

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

input:

0 1

output:

1 2
..

result:

ok good solution

Test #10:

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

input:

1 2

output:

1 4
.##.

result:

ok good solution

Test #11:

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

input:

1 3

output:

1 6
.##...

result:

ok good solution

Test #12:

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

input:

1 4

output:

1 8
.##.....

result:

ok good solution

Test #13:

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

input:

1 5

output:

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

result:

ok good solution

Test #14:

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

input:

1 6

output:

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

result:

ok good solution

Test #15:

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

input:

1 7

output:

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

result:

ok good solution

Test #16:

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

input:

1 8

output:

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

result:

ok good solution

Test #17:

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

input:

1 9

output:

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

result:

ok good solution

Test #18:

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

input:

1 10

output:

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

result:

ok good solution

Test #19:

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

input:

2 5

output:

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

result:

ok good solution

Test #20:

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

input:

2 7

output:

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

result:

ok good solution

Test #21:

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

input:

2 9

output:

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

result:

ok good solution

Test #22:

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

input:

3 7

output:

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

result:

ok good solution

Test #23:

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

input:

3 8

output:

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

result:

ok good solution

Test #24:

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

input:

3 10

output:

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

result:

ok good solution

Test #25:

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

input:

4 7

output:

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

result:

ok good solution

Test #26:

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

input:

4 9

output:

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

result:

ok good solution

Test #27:

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

input:

5 6

output:

-1 -1

result:

ok no solution

Test #28:

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

input:

5 8

output:

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

result:

ok good solution

Test #29:

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

input:

5 9

output:

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

result:

ok good solution

Test #30:

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

input:

6 7

output:

-1 -1

result:

ok no solution

Test #31:

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

input:

7 8

output:

-1 -1

result:

ok no solution

Test #32:

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

input:

8 9

output:

-1 -1

result:

ok no solution

Test #33:

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

input:

9 10

output:

-1 -1

result:

ok no solution

Extra Test:

score: 0
Extra Test Passed