QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#189534#2880. Letters Q and Ftriplem5ds#WA 1ms3552kbC++232.1kb2023-09-27 16:32:032023-09-27 16:33:07

Judging History

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

  • [2023-09-27 16:33:07]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3552kb
  • [2023-09-27 16:32:03]
  • 提交

answer

/// Msaa el 5ra
#pragma GCC optimize("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx,avx2,fma")

#include "bits/stdc++.h"

using namespace std;

#define pb push_back
#define F first
#define S second
#define f(i, a, b)  for(int i = a; i < b; i++)
#define all(a)  a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(x) (int)(x).size()
#define mp(x, y) make_pair(x,y)
#define popCnt(x) (__builtin_popcountll(x))
#define int ll

using ll = long long;
using ii = pair<int, int>;
using ull = unsigned long long;

const int N = 5e5 + 5, LG = 18, MOD = 1e9 + 7;
const long double PI = acos(-1);
const long double EPS = 1e-7;

vector<string> F = {
        "###",
        "#..",
        "##.",
        "#..",
        "#.."
};
vector<string> Q = {
        "###",
        "#.#",
        "###",
        "..#",
        ".w#"
};
char grid[305][305];
int n, m;

void doWork() {
    cin >> n >> m;
    f(i, 0, n) {
        f(j, 0, m) cin >> grid[i][j];
    }

    int ans1 = 0, ans2 = 0;

    for (int i = 0; i + 5 <= n; i++)
        for (int j = 0; j + 3 <= m; j++) {
            bool okF = true, okQ = true;
            f(ii, 0, 5)
                f(jj, 0, 3) {
                    if (F[ii][jj] == '#' && grid[i + ii][j + jj] != '#')okF = false;
                    if (Q[ii][jj] == '#' && grid[i + ii][j + jj] != '#')okQ = false;
                    if (F[ii][jj] == 'w' && grid[i + ii][j + jj] != '.')okF = false;
                    if (Q[ii][jj] == 'w' && grid[i + ii][j + jj] != '.')okQ = false;
                }
            ans1 += okQ;
            ans2 += okF;
            if (okQ || okF) {
                if (okF) {
                    f(ii, 0, 5)f(jj, 0, 3)if (F[ii][jj] == '#') grid[i + ii][j + jj] = '.';
                } else
                    f(ii, 0, 5)f(jj, 0, 3)if (Q[ii][jj] == '#') grid[i + ii][j + jj] = '.';
            }

        }
    cout << ans1 << ' ' << ans2 << '\n';
}

int32_t main() {
#ifdef ONLINE_JUDGE
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif // ONLINE_JUDGE

    int t = 1;
//    cin >> t;
    while (t--) {
        doWork();
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

1 0

result:

ok single line: '1 0'

Test #2:

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

input:

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

output:

0 1

result:

ok single line: '0 1'

Test #3:

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

input:

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

output:

1 1

result:

ok single line: '1 1'

Test #4:

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

input:

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

output:

2 2

result:

ok single line: '2 2'

Test #5:

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

input:

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

output:

2 4

result:

wrong answer 1st lines differ - expected: '1 4', found: '2 4'