QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#514025#7637. Exactly Three NeighborsDinalWA 0ms3800kbC++141.8kb2024-08-10 21:13:432024-08-10 21:13:44

Judging History

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

  • [2024-08-10 21:13:44]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3800kb
  • [2024-08-10 21:13:43]
  • 提交

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{
            puts("-1 -1");
        }
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2 3

output:

1 6
.##.##

result:

ok good solution

Test #2:

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

input:

1 1

output:

-1 -1

result:

ok no solution

Test #3:

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

input:

3 4

output:

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

result:

ok good solution

Test #4:

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

input:

3 5

output:

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

result:

ok good solution

Test #5:

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

input:

4 5

output:

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

result:

ok good solution

Test #6:

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

input:

7 10

output:

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

result:

ok good solution

Test #7:

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

input:

5 7

output:

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

result:

ok good solution

Test #8:

score: -100
Wrong Answer
time: 0ms
memory: 3632kb

input:

7 9

output:

-1 -1

result:

wrong answer you didn't find a solution but jury did