QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#189534 | #2880. Letters Q and F | triplem5ds# | WA | 1ms | 3552kb | C++23 | 2.1kb | 2023-09-27 16:32:03 | 2023-09-27 16:33:07 |
Judging History
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();
}
}
详细
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'