QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#648880#3125. Dango MakerDimash13 1ms5776kbC++171.8kb2024-10-17 20:49:192024-10-17 20:49:20

Judging History

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

  • [2024-10-17 20:49:20]
  • 评测
  • 测评结果:13
  • 用时:1ms
  • 内存:5776kb
  • [2024-10-17 20:49:19]
  • 提交

answer

#include <bits/stdc++.h>
    
using namespace std;
    
typedef long long ll;
    
const int  N = 3e3 + 12, MOD = 998244353;
    
char a[N][N], b[N][N];
int n, m, res = 0, res1 = 0;
void test() {
    cin >> n >> m;
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= m; j++) {
            cin >> a[i][j];
            b[i][j] = a[i][j];
        }
    }
    for(int i = 1; i <= n; i++) {
        for(int j = 2; j < m; j++) {
            if(a[i][j] == 'G' && a[i][j - 1] == 'R' && a[i][j + 1] == 'W') {
                res++;
                a[i][j] = a[i][j - 1] = a[i][j + 1] = '-';
            }
        }
    }
    for(int j = 1; j <= m; j++) {
        for(int i = 2; i < n; i++) {
            if(a[i][j] == 'G' && a[i - 1][j] == 'R' && a[i + 1][j] == 'W') {
                res++;
                a[i][j] = a[i - 1][j] = a[i + 1][j] = '-';
            }
        }
    }
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= m; j++) {
            a[i][j] = b[i][j];
        }
    }
    for(int j = 1; j <= m; j++)
        for(int i = 2; i < n; i++) { {
            if(a[i][j] == 'G' && a[i - 1][j] == 'R' && a[i + 1][j] == 'W') {
                res1++;
                a[i][j] = a[i - 1][j] = a[i + 1][j] = '-';
            }
        }
    }
    for(int i = 1; i <= n; i++) {
        for(int j = 2; j < m; j++) {
            if(a[i][j] == 'G' && a[i][j - 1] == 'R' && a[i][j + 1] == 'W') {
                res1++;
                a[i][j] = a[i][j - 1] = a[i][j + 1] = '-';
            }
        }
    }
    cout << max(res1, res) << '\n';
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0); 
    
    int t = 1; 
    // cin >> t;
    
    while(t--) 
        test();
    
    return 0;
}

詳細信息

Subtask #1:

score: 13
Accepted

Test #1:

score: 13
Accepted
time: 0ms
memory: 5636kb

input:

1 1
G

output:

0

result:

ok single line: '0'

Test #2:

score: 13
Accepted
time: 1ms
memory: 5640kb

input:

1 2
RG

output:

0

result:

ok single line: '0'

Test #3:

score: 13
Accepted
time: 1ms
memory: 5756kb

input:

2 1
W
R

output:

0

result:

ok single line: '0'

Test #4:

score: 13
Accepted
time: 1ms
memory: 5696kb

input:

3 2
WW
RW
WR

output:

0

result:

ok single line: '0'

Test #5:

score: 13
Accepted
time: 0ms
memory: 5608kb

input:

4 4
GRRW
GWWR
WWWW
RGRG

output:

0

result:

ok single line: '0'

Test #6:

score: 13
Accepted
time: 1ms
memory: 5648kb

input:

4 4
RGRR
RRRG
GRGW
RGWW

output:

2

result:

ok single line: '2'

Test #7:

score: 13
Accepted
time: 1ms
memory: 5732kb

input:

4 4
RRGR
GRRG
WRGW
RGWW

output:

3

result:

ok single line: '3'

Test #8:

score: 13
Accepted
time: 1ms
memory: 5604kb

input:

4 4
RGWR
GGGW
WWGW
RWGW

output:

1

result:

ok single line: '1'

Test #9:

score: 13
Accepted
time: 1ms
memory: 5728kb

input:

3 3
RGW
GGG
WGW

output:

1

result:

ok single line: '1'

Test #10:

score: 13
Accepted
time: 1ms
memory: 5736kb

input:

4 1
W
R
G
W

output:

1

result:

ok single line: '1'

Test #11:

score: 13
Accepted
time: 1ms
memory: 5736kb

input:

4 4
RGWR
GWRG
WRGW
RGWR

output:

3

result:

ok single line: '3'

Test #12:

score: 13
Accepted
time: 0ms
memory: 5736kb

input:

4 4
RWWR
GWRG
WGGW
RGWR

output:

3

result:

ok single line: '3'

Test #13:

score: 13
Accepted
time: 1ms
memory: 5708kb

input:

4 4
RGWR
WWRG
WRGW
RWGR

output:

2

result:

ok single line: '2'

Test #14:

score: 13
Accepted
time: 1ms
memory: 5772kb

input:

4 4
RRRR
GGGG
WWWW
RRRR

output:

4

result:

ok single line: '4'

Test #15:

score: 13
Accepted
time: 1ms
memory: 5656kb

input:

4 4
RRRR
GGGR
WWWW
RRRR

output:

3

result:

ok single line: '3'

Test #16:

score: 13
Accepted
time: 1ms
memory: 5696kb

input:

4 4
RRRR
GGGG
WWWW
RWRR

output:

4

result:

ok single line: '4'

Subtask #2:

score: 0
Wrong Answer

Dependency #1:

100%
Accepted

Test #17:

score: 20
Accepted
time: 0ms
memory: 5660kb

input:

5 5
RRGRR
RGRGW
RRWRW
RGWGW
RWWWW

output:

3

result:

ok single line: '3'

Test #18:

score: 20
Accepted
time: 0ms
memory: 5712kb

input:

6 6
RGWRGW
RRRGWR
RRWGWR
WRRRWG
GGGGGW
WWWWWW

output:

7

result:

ok single line: '7'

Test #19:

score: 20
Accepted
time: 1ms
memory: 5776kb

input:

7 10
RRRGRGWRGW
RGGGWRRGWR
RWWWWGRRGG
RGWRWWGGGW
WWRGWRGWGW
RGWWGGRGWW
RRGWWWWWWW

output:

14

result:

ok single line: '14'

Test #20:

score: 0
Wrong Answer
time: 1ms
memory: 5672kb

input:

10 8
RGWRRRGW
RGWGRRGW
WRGWGRGW
RGWWRGWW
GWRRGWWW
WRRGRWRR
GRGWGRGG
WGWWWRWR
RGWRGRGW
RRWRGWWW

output:

15

result:

wrong answer 1st lines differ - expected: '16', found: '15'

Subtask #3:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

0%