QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#671632#2880. Letters Q and FIllusionaryDominance#WA 0ms3816kbC++201.5kb2024-10-24 13:47:112024-10-24 13:47:12

Judging History

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

  • [2024-10-24 13:47:12]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3816kb
  • [2024-10-24 13:47:11]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

const int MAX_N = 300 + 5;

int N, M;
char str[MAX_N][MAX_N];

int main() {
    scanf("%d%d", &N, &M);
    for (int i = 1; i <= N; i ++) {
        scanf("%s", str[i] + 1);
    }
    int cnt[2] = {0, 0};
    for (int i = 1; i <= N; i ++) {
        for (int j = 1; j <= M; j ++) {
            if (str[i][j] == '#') {
                char F = str[i][j + 1] == '#' && str[i][j + 2] == '#' && str[i + 2][j + 1] == '#';
                for (int k = 1; k <= 4; k ++) {
                    if (i + k > N || str[i + k][j] != '#') {
                        F = 0; break;
                    }
                }
                if (F) {
                    cnt[1] ++;
                    for (int k = 0; k < 5; k ++) str[i + k][j] = -1;
                    str[i][j + 1] = str[i][j + 2] = str[i + 2][j + 1] = -1;
                }
                char Q = str[i + 1][j] == '#' && str[i + 2][j] == '#' && str[i][j + 1] == '#' && str[i + 2][j + 1] == '#';
                for (int k = 0; k < 5; k ++) {
                    if (i + k > N || str[i + k][j + 2] != '#') {Q = 0; break;}
                }
                if (Q) {
                    cnt[0] ++;
                    str[i][j] = str[i + 1][j] = str[i + 2][j] = str[i][j + 1] = str[i + 2][j + 1] = -1;
                    for (int k = 0; k < 5; k ++) {
                        str[i + k][j + 2] = -1;
                    }
                }
            }
        }
    }
    cout << cnt[0] << ' ' << cnt[1] << endl;
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5 3
###
#.#
###
..#
..#

output:

1 0

result:

ok single line: '1 0'

Test #2:

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

input:

5 3
###
#..
##.
#..
#..

output:

0 1

result:

ok single line: '0 1'

Test #3:

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

input:

5 8
###..###
#.#..#..
###..##.
..#..#..
..#..#..

output:

1 1

result:

ok single line: '1 1'

Test #4:

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

input:

8 8
.....###
###..#.#
#.######
###.####
#.###.##
#.#.###.
..#...#.
......#.

output:

2 2

result:

ok single line: '2 2'

Test #5:

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

input:

10 10
....###...
....#.###.
....###...
....#.##..
###.#.####
#.###.##..
###.#..##.
#.###..#..
#...#..#..
....#.....

output:

1 4

result:

ok single line: '1 4'

Test #6:

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

input:

50 50
###..................###.......###...###.......###
#.....###.........####..###....#.....#.####.####.#
#####.#...######..#.###.#.###..##....####...#..###
#.#...##..#.##....####..###....#.......###..##...#
#.##..#...#####.###.##..#.##...#.###...##...#....#
..#####.###.##..#.#.#...#.#......#.####...

output:

62 72

result:

wrong answer 1st lines differ - expected: '66 70', found: '62 72'