QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#216128 | #2880. Letters Q and F | karuna# | AC ✓ | 1ms | 4008kb | C++17 | 1.2kb | 2023-10-15 16:00:16 | 2023-10-15 16:00:17 |
Judging History
answer
#include <bits/stdc++.h>
#define ff first
#define ss second
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int MAXN = 300;
int N, M;
char S[MAXN+10][MAXN+10];
bool Q[5][3], F[5][3];
int ansQ=0, ansF=0;
void doQ(int y, int x)
{
ansQ++;
for(int i=0; i<5; i++) for(int j=0; j<3; j++)
{
if(Q[i][j]) S[y+i][x+j]='.';
}
}
void doF(int y, int x)
{
ansF++;
for(int i=0; i<5; i++) for(int j=0; j<3; j++)
{
if(F[i][j]) S[y+i][x+j]='.';
}
}
int main() {
cin.tie(0); ios_base::sync_with_stdio(0);
scanf("%d%d", &N, &M);
for(int i=1; i<=N; i++) scanf(" %s", S[i]+1);
for(int i=1; i<=M; i++) S[N+1][i]='.';
Q[0][0]=Q[0][1]=Q[0][2]=Q[1][0]=Q[1][2]=Q[2][0]=Q[2][1]=Q[2][2]=Q[3][2]=Q[4][2]=true;
F[0][0]=F[0][1]=F[0][2]=F[1][0]=F[2][0]=F[2][1]=F[3][0]=F[4][0]=true;
for(int i=1; i<=M; i++)
{
int l=0, r=0;
bool flag=false;
for(int j=1; j<=N+1; j++)
{
if(!flag && S[j][i]=='#')
{
l=j;
flag=true;
}
if(S[j][i]=='.' && flag)
{
r=j-1;
for(; l+4<=r; l+=5) doF(l, i);
if(l<=r) doQ(l, i);
flag=false;
}
}
}
printf("%d %d\n", ansQ, ansF);
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3868kb
input:
5 3 ### #.# ### ..# ..#
output:
1 0
result:
ok single line: '1 0'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
5 3 ### #.. ##. #.. #..
output:
0 1
result:
ok single line: '0 1'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3912kb
input:
5 8 ###..### #.#..#.. ###..##. ..#..#.. ..#..#..
output:
1 1
result:
ok single line: '1 1'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3904kb
input:
8 8 .....### ###..#.# #.###### ###.#### #.###.## #.#.###. ..#...#. ......#.
output:
2 2
result:
ok single line: '2 2'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3924kb
input:
10 10 ....###... ....#.###. ....###... ....#.##.. ###.#.#### #.###.##.. ###.#..##. #.###..#.. #...#..#.. ....#.....
output:
1 4
result:
ok single line: '1 4'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3860kb
input:
50 50 ###..................###.......###...###.......### #.....###.........####..###....#.....#.####.####.# #####.#...######..#.###.#.###..##....####...#..### #.#...##..#.##....####..###....#.......###..##...# #.##..#...#####.###.##..#.##...#.###...##...#....# ..#####.###.##..#.#.#...#.#......#.####...
output:
66 70
result:
ok single line: '66 70'
Test #7:
score: 0
Accepted
time: 1ms
memory: 3956kb
input:
100 100 ....###..###........######..###..###..........###....................................###...###...... .####....#.#..#######.##.####.#..#.#....###...#....###........###...###..###..###.####.....#.####... .#..##...###..#.##..######.####..###.####.....######..........#..####....#.####...#..##.##...
output:
280 298
result:
ok single line: '280 298'
Test #8:
score: 0
Accepted
time: 0ms
memory: 4008kb
input:
300 300 ...............###.###....###..###....######........###...###..###..###....###..........###..######......###....#########...............###.............###.###..###.###.........###.........###..........###....###.######.......###......###.....###...................###..###.......###............
output:
2472 2694
result:
ok single line: '2472 2694'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3968kb
input:
5 298 .############.######..#########.######.###.######.######.######.##################.############.###..###..###..###.###.#####################.###..#########..###..###.###.######..###..###..###.######.###..###..######..###.###.###.######.###.###..######..#########.#########.######.###..###.#####...
output:
41 39
result:
ok single line: '41 39'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3992kb
input:
299 3 ### #.. ##. #.. #.. ... ... ### #.# ### ..# ..# ... ... ... ### #.# ### ..# ..# ... ### #.# ### ..# ..# ### #.# ### ..# ..# ... ### #.. ##. #.. #.. ... ... ... ### #.. ##. #.. #.. ### #.# ### ..# ..# ... ... ### #.. ##. #.. #.. ... ... ### #.# ### ..# ..# ### #.# ### ..# ..# ### #.. ##. #.. #....
output:
26 20
result:
ok single line: '26 20'
Test #11:
score: 0
Accepted
time: 1ms
memory: 3904kb
input:
123 234 .........###....###.###....###....###....###....###.....###.......######...........###..............###.###....###.......###...###......###........###............................###........###.......###....###...###..###..###......... ###..###.#...####.#.#.#....#.#.####.####.#.#....#..###..#...
output:
785 838
result:
ok single line: '785 838'
Test #12:
score: 0
Accepted
time: 1ms
memory: 3860kb
input:
234 123 .###........###.###...........###..######.............###....###...######..######................................###....... .#.#........#.#.#.#.###..###..#....#..#.#.............#.####.#.#...#..#.#..#..#.........###..............###.###.#.#######. .###........###.###.#.####.#####...##.###......
output:
805 836
result:
ok single line: '805 836'
Test #13:
score: 0
Accepted
time: 0ms
memory: 3868kb
input:
5 3 ... ... ... ... ...
output:
0 0
result:
ok single line: '0 0'
Test #14:
score: 0
Accepted
time: 1ms
memory: 4008kb
input:
300 300 .......................................................................................................................................................................................................................................................................................................
output:
0 0
result:
ok single line: '0 0'
Test #15:
score: 0
Accepted
time: 1ms
memory: 3912kb
input:
300 300 ###........###........###........###........###........###........###........###........###........###........###........###........###........###........###........###........###........###........###........###........###........###........###........###........###........###........###......
output:
8019 0
result:
ok single line: '8019 0'
Test #16:
score: 0
Accepted
time: 1ms
memory: 3932kb
input:
300 300 ###........###........###........###........###........###........###........###........###........###........###........###........###........###........###........###........###........###........###........###........###........###........###........###........###........###........###......
output:
0 8019
result:
ok single line: '0 8019'