QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#189834#2880. Letters Q and FMaGnsi0#WA 1ms3512kbC++171.8kb2023-09-27 23:44:502023-09-27 23:44:52

Judging History

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

  • [2023-09-27 23:44:52]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3512kb
  • [2023-09-27 23:44:50]
  • 提交

answer

/**
 *    author:  MaGnsi0
 *    created: 27.09.2023 18:36:24
**/
#include <bits/stdc++.h>

using namespace std;

const int dx_f[8] = {0, 1, 2, 3, 4, 0, 0, 2};
const int dy_f[8] = {0, 0, 0, 0, 0, 1, 2, 1};

const int dx_q[10] = {0, 0, 0, 1, 2, 3, 4, 1, 2, 2};
const int dy_q[10] = {0, 1, 2, 2, 2, 2, 2, 0, 0, 1};

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n, m;
    cin >> n >> m;
    vector<string> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    int F = 0, Q = 0;
    function<void(int, int)> countF = [&](int x, int y) {
        for (int i = 0; i < 8; ++i) {
            int nx = x + dx_f[i];
            int ny = y + dy_f[i];
            if (nx < 0 || nx >= n) { return; }
            if (ny < 0 || ny >= m) { return; }
            if (a[nx][ny] == '.') { return; }
        }
        F++;
        for (int i = 0; i < 8; ++i) {
            int nx = x + dx_f[i];
            int ny = y + dy_f[i];
            a[nx][ny] = '.';
        }
    };
    function<void(int, int)> countQ = [&](int x, int y) {
        for (int i = 0; i < 10; ++i) {
            int nx = x + dx_q[i];
            int ny = y + dy_q[i];
            if (nx < 0 || nx >= n) { return; }
            if (ny < 0 || ny >= m) { return; }
            if (a[nx][ny] == '.') { return; }
        }
        Q++;
        for (int i = 0; i < 10; ++i) {
            int nx = x + dx_q[i];
            int ny = y + dy_q[i];
            a[nx][ny] = '.';
        }
    };
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            countF(i, j);
        }
    }
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            countQ(i, j);
        }
    }
    cout << Q << " " << F;
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3512kb

input:

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

output:

1 0

result:

ok single line: '1 0'

Test #2:

score: 0
Accepted
time: 1ms
memory: 3496kb

input:

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

output:

0 1

result:

ok single line: '0 1'

Test #3:

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

input:

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

output:

1 1

result:

ok single line: '1 1'

Test #4:

score: 0
Accepted
time: 1ms
memory: 3472kb

input:

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

output:

2 2

result:

ok single line: '2 2'

Test #5:

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

input:

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

output:

1 4

result:

ok single line: '1 4'

Test #6:

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

input:

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

output:

50 75

result:

wrong answer 1st lines differ - expected: '66 70', found: '50 75'