QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#245375#7637. Exactly Three Neighborsucup-team2307#WA 0ms3804kbC++173.4kb2023-11-09 21:10:562023-11-09 21:10:57

Judging History

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

  • [2023-11-09 21:10:57]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3804kb
  • [2023-11-09 21:10:56]
  • 提交

answer

#include<bits/stdc++.h>

#define pb push_back
#define fi first
#define se second

using namespace std;

bool ask(int p, int q)
{

    if (p*5 >= q*4)
    {
        if (p*5 == q*4)
        {
            cout<<5<<" "<<5<<"\n";
            cout<<"###.#\n";
            cout<<"#.###\n";
            cout<<"####.\n";
            cout<<"##.##\n";
            cout<<".####\n";
        }
        else
        {
            cout<<-1<<" "<<-1<<"\n";
        }
        return true;
    }

    if (p==2)
    {
        cout<<1<<" "<<q<<"\n";
        cout<<"##"<<string(q-2, '.');
        cout<<"\n";
        return true;
    }

    for (int x=0; x<=100; x++)
        for (int k=1; k<=100; k++)
            if (p*(2*x+8*k) == q*(x+6*k))
    {
        cout<<x+4*k<<" "<<4<<"\n";
        for (int i=0; i<x; i++)
            cout<<".##.\n";
        for (int i=0; i<k; i++)
        {
            cout<<".##.\n";
            cout<<"####\n";
            cout<<"#..#\n";
            cout<<"####\n";
        }
        return true;
    }

    for (int x=0; x<=100; x++)
        for (int y=0; y<=100; y++)
            if (p*(8+x)*(8+y) == q*(48+4*x+4*y))
    {
//        exit(1);

        vector<vector<char> > v(8+x, vector<char>(8+y, '.'));
        for (int i=0; i<8; i++) v[0][i] = ".##.##.."[i];
        for (int i=0; i<8; i++) v[1][i] = "###.####"[i];
        for (int i=0; i<8; i++) v[2][i] = "#.###.##"[i];
        for (int i=0; i<8; i++) v[3][i] = "#######."[i];
        for (int i=0; i<8; i++) v[4][i] = "##...##."[i];
        for (int i=0; i<8; i++) v[5][i] = "#######."[i];
        for (int i=0; i<8; i++) v[6][i] = "#.###.##"[i];
        for (int i=0; i<8; i++) v[7][i] = "###.####"[i];

        for (int i=8; i<8+y; i++)
        {
            v[1][i] = '#';
            v[2][i] = '#';
            v[6][i] = '#';
            v[7][i] = '#';
        }
        for (int i=8; i<8+x; i++)
        {
            v[i][1] = '#';
            v[i][2] = '#';
            v[i][4] = '#';
            v[i][5] = '#';
        }



        cout<<8+x<<" "<<8+y<<"\n";
        for (int i=0; i<8+x; i++, cout<<"\n")
            for (int j=0; j<8+y; j++)
                cout<<v[i][j];

        return true;
    }


    {
//        if (p==7 && q == 9)
//            exit(1);
        cout<<-1<<" "<<-1<<"\n";

//        cout<<6<<" "<<18<<"\n";
//        cout<<".####.\n";
//        cout<<"###.##\n";
//        cout<<"#.####\n";
//        cout<<"####..\n";
//        cout<<"##.###\n";
//        cout<<".#####\n";
//        cout<<"###..#\n";
//        cout<<"#.####\n";
//        cout<<"#####.\n";
//        cout<<"##..##\n";
//        cout<<".#####\n";
//        cout<<"####.#\n";
//        cout<<"#..###\n";
//        cout<<"#####.\n";
//        cout<<"###.##\n";
//        cout<<"..####\n";
//        cout<<"####.#\n";
//        cout<<"##.###\n";
        return true;
    }

    return false;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int p, q;
    cin>>p>>q;
    ask(p, q);
//    for (int p=1; p<=10; p++)
//        for (int q=p; q<=10; q++)
//        {
//            if (__gcd(p, q) == 1)
//            {
////                cout<<p<<"/"<<q<<"\n";
//                if (!ask(p, q))
//                    cout<<p<<"/"<<q<<" not found!!!!!!!!!!!!!!!!!!!\n";
//            }
//        }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2 3

output:

1 3
##.

result:

ok good solution

Test #2:

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

input:

1 1

output:

-1 -1

result:

ok no solution

Test #3:

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

input:

3 4

output:

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

result:

ok good solution

Test #4:

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

input:

3 5

output:

10 4
.##.
.##.
.##.
.##.
.##.
.##.
.##.
####
#..#
####

result:

ok good solution

Test #5:

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

input:

4 5

output:

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

result:

ok good solution

Test #6:

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

input:

7 10

output:

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

result:

ok good solution

Test #7:

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

input:

5 7

output:

14 4
.##.
.##.
.##.
####
#..#
####
.##.
####
#..#
####
.##.
####
#..#
####

result:

ok good solution

Test #8:

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

input:

7 9

output:

-1 -1

result:

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