QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#43784#2553. BingoUfowoqqqoWA 2ms3712kbC++994b2022-08-10 23:14:232022-08-10 23:16:47

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-08-10 23:16:47]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3712kb
  • [2022-08-10 23:14:23]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

const int N = 110;

char s[N][N];

int main()
{
    int n, k;
    int i, j;

    scanf("%d%d", &n, &k);

    if(n == 2)
    {
        if(k > 1)
            puts("NO");
        else
        {
            puts("YES");
            puts("#.");
            puts("..");
        }
        return 0;
    }

    if(k > n * (n - 1))
        puts("NO");
    else
    {
        puts("YES");
        for(i = 0; i < n; i ++)
            for(j = 0; j < n; j ++)
                s[i][j] = '#';
        s[0][0] = s[n - 1][n - 1] = '.';
        for(i = 1; i + 1 < n; i ++)
            s[i][n - i - 1] = '.';
        for(i = 0; i < n; i ++)
            for(j = 0; j < n; j ++)
                if(s[i][j] == '#')
                    if(k > 0)
                        k --;
                    else
                        s[i][j] = '.';
        for(i = 0; i < n; i ++)
            puts(s[i]);
    }

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4 2

output:

YES
.##.
....
....
....

result:

ok n=4, k=2

Test #2:

score: 0
Accepted
time: 2ms
memory: 3516kb

input:

4 16

output:

NO

result:

ok n=4, k=16

Test #3:

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

input:

2 0

output:

YES
#.
..

result:

wrong answer 1 filled cells instead of 0