ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#211263 | #3802. 印章 | Anthonyyan | 20 | 318ms | 3276kb | C++11 | 2.4kb | 2024-08-10 10:30:05 | 2024-08-10 12:37:12 |
answer
#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
int T;
int n, m, W, L;
char seal[2010][2010];
namespace testpoint1to4
{
struct DoubleArray
{
int a[110][110];
};
int cnt;
int main()
{
DoubleArray a;
memset(a.a, 0, sizeof a.a);
for (int x = 1; x <= W - n + 1; x++)
for (int y = 1; y <= L - m + 1; y++)
for (int i = x; i <= x + n - 1; i++)
for (int j = y; j <= y + m - 1; j++)
if (seal[i - x + 1][j - y + 1] == '#')
a.a[i][j] = 1;
cnt = 0;
for (int i = 1; i <= W; i++)
for (int j = 1; j <= L; j++)
cnt += a.a[i][j];
cout << cnt << '\n';
return 0;
}
}
namespace testpoint5to6
{
int main()
{
int cnt1 = 0, cnt2 = 0;
int i = m;
while (seal[1][m - (cnt1++)] != '#')
;
cnt1--;
while (seal[1][++cnt2] != '#')
;
cnt2--;
int t = L - m;
for (int i = 1; i <= t; i++)
{
for (int j = 2; j <= m; j++)
if (seal[1][j - 1] == '#')
seal[1][j] = '$';
for (int j = 2; j <= m; j++)
if (seal[1][j] == '$')
seal[1][j] = '#';
}
int cnt3 = 0;
for (int i = cnt2 + 1; i <= m - cnt1; i++)
if (seal[1][i] == '.')
cnt3++;
cout << L - cnt1 - cnt2 - cnt3 << '\n';
return 0;
}
}
namespace testpoint7to8
{
int main()
{
int cnt1 = 0, cnt2 = 0;
int i = m;
while (seal[1][m - (cnt1++)] != '#')
;
cnt1--;
while (seal[1][++cnt2] != '#')
;
cnt2--;
int t = L - m;
for (int i = 1; i <= t; i++)
{
for (int j = 2; j <= m; j++)
if (seal[1][j - 1] == '#')
seal[1][j] = '$';
for (int j = 2; j <= m; j++)
if (seal[1][j] == '$')
seal[1][j] = '#';
}
int cnt3 = 0;
for (int i = cnt2 + 1; i <= m - cnt1; i++)
if (seal[1][i] == '.')
cnt3++;
cout << (L - cnt1 - cnt2 - cnt3) * W << '\n';
return 0;
}
}
int solve()
{
cin >> W >> L >> n >> m;
for (int i = 1; i <= n; i++)
cin >> (seal[i] + 1);
if (W <= 100 && L <= 100)
return testpoint1to4::main();
if (W == 1 && n == 1)
return testpoint5to6::main();
if (W == 1)
return testpoint7to8::main();
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> T;
while (T--)
solve();
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 5
Accepted
time: 49ms
memory: 1360kb
input:
2040 20 2 1 1 . 24 4 1 2 .# 24 3 5 2 .# #. .. .# ## 36 35 1 4 #..# 1 47 1 7 ##..#.# 4 9 2 7 ....... ...
output:
0 72 71 1260 47 0 173 899 40 58 81 1147 194 63 515 455 1166 1230 671 42 21 0 32 802 275 405 262 832 ...
result:
ok 2040 tokens
Test #2:
score: 5
Accepted
time: 77ms
memory: 1360kb
input:
3691 50 41 1 1 # 10 43 5 4 .... .... .... .... #... 3 1 2 1 . # 13 8 7 7 ####..# #.#.... .....## ..#...
output:
2050 240 2 100 70 1268 251 239 351 0 331 153 44 1070 0 6 1512 206 287 123 24 1338 0 1967 108 2 700 8...
result:
ok 3691 tokens
Test #3:
score: 5
Accepted
time: 42ms
memory: 1400kb
input:
307 19 2 1 1 . 4 6 3 3 #.. ### #.# 1 11 1 8 .#####.. 16 7 10 5 .###. .###. ##... .#.#. .###. ...#. #...
output:
0 22 8 93 1666 72 216 137 341 73 32 431 605 100 267 0 105 218 447 315 228 308 559 291 491 66 135 460...
result:
ok 307 tokens
Test #4:
score: 5
Accepted
time: 70ms
memory: 1404kb
input:
1151 2 2 1 2 ## 4 90 2 1 # . 4 3 2 2 .. .. 55 39 8 8 ....#... ......#. ...#..#. #......# ##.#...# .....
output:
4 270 0 2127 0 66 162 157 156 102 243 752 132 2969 38 579 34 93 204 585 211 28 5692 99 4221 193 220 ...
result:
ok 1151 tokens
Test #5:
score: 0
Time Limit Exceeded
input:
142992 1 71640447 1 5 .#.#. 1 32 1 16 .##..#.#.##.#.## 1 128754717 1 13 #...#.#####.# 1 412912033 1 ...
output:
result:
Test #6:
score: 0
Runtime Error
input:
182430 1 462437573 1 2 .. 1 4 1 2 #. 2 2 1 1 # 1 117654376 1 6 .#..## 1 3 1 2 ## 1 4 1 4 ...# 1 2 1 ...
output:
result:
Test #7:
score: 0
Time Limit Exceeded
input:
167051 949063550 696367111 1 9 #.####... 2 5 1 4 .... 18713003 154314157 1 6 ...... 144789507 649449...
output:
result:
Test #8:
score: 0
Runtime Error
input:
182067 1 970907619 1 5 ..... 1 11 1 6 ..#.#. 588221550 1 1 1 # 1 16 1 8 ###.#.#. 1 13 1 9 .#...#... ...
output:
result:
Test #9:
score: 0
Wrong Answer
time: 8ms
memory: 1480kb
input:
49 518642469 504232726 3 66 ...#...............#............#................................. ........
output:
222 2234 1752 7974 0 673 2241 4202 78
result:
wrong answer 1st words differ - expected: '261516504407313028', found: '222'
Test #10:
score: 0
Time Limit Exceeded
input:
340 2 305388993 1 1 # 6 450728609 3 12 ............ ............ ..#......... 23 55 12 32 #.#...###....
output:
result:
Test #11:
score: 0
Runtime Error
input:
9859 39 2 27 1 . . . . . . . . . . . . . . . . . . . . . . . # . . . 464574874 21687964 9 3 ... .#. ...
output:
result:
Test #12:
score: 0
Time Limit Exceeded
input:
5532 283728969 997644030 17 11 #.........# ........#.. ..#........ ........... #...#...#.. #.....#.....
output:
result:
Test #13:
score: 0
Time Limit Exceeded
input:
419 61075512 474658573 4 11 ###...#.... .....#...## ###..###..# #.##.#..### 2 42 2 24 ...#.....####....
output:
result:
Test #14:
score: 0
Time Limit Exceeded
input:
116 658506323 6 2 6 ...... .....# 2 465009927 2 3 .#. ### 4 2 2 2 .. .. 3 109507599 2 4 ##.. ...# 47...
output:
result:
Test #15:
score: 0
Wrong Answer
time: 15ms
memory: 3268kb
input:
498 217 913116486 174 8 ...#...# ........ ........ #.##.... .......# #....... ........ ........ .......
output:
1023 121 644 1208 644 419 1006 48 497 17 182 12 94 837 528 510 294 1889 18 25 118 1333 334 32 88 40 ...
result:
wrong answer 1st words differ - expected: '198146277411', found: '1023'
Test #16:
score: 0
Wrong Answer
time: 57ms
memory: 3276kb
input:
1152 6 45902942 3 1000 ................................................................................
output:
3010 1398 4263 1463 2558 215 1468 910 701 6 4422 264 995 1098 80 2138 355 857 336 101 205 2427 846 5...
result:
wrong answer 1st words differ - expected: '0', found: '3010'
Test #17:
score: 0
Time Limit Exceeded
input:
3328 5 710527822 4 200 .............................................#..................................
output:
result:
Test #18:
score: 0
Time Limit Exceeded
input:
248 625825389 5 4 3 .## .#. #.. .## 27877511 627106582 3 2 .# #. .. 2317584 8 3 6 .#...# ..#... ...#...
output:
result:
Test #19:
score: 0
Time Limit Exceeded
input:
165923 21611739 641706900 9 3 ..# ... #.. ... .#. ... .## ... ... 283865732 7 2 6 ####.. ....#. 3146...
output:
result:
Test #20:
score: 0
Time Limit Exceeded
input:
566 579629199 26826670 3 2000 .........................................................................