QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#54778 | #3125. Dango Maker | lmeowdn | 13 | 3ms | 3828kb | C++17 | 1.2kb | 2022-10-10 12:17:27 | 2022-10-10 12:17:29 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
using namespace std;
#define fi first
#define se second
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define eb emplace_back
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vp;
typedef unsigned long long ull;
long long read() {
long long res=0, w=1; char c=getchar();
while(!isdigit(c)) {if(c=='-') w=-1; c=getchar();}
while(isdigit(c)) {res=res*10+c-48, c=getchar();}
return res*w;
}
const int N=5009;
int n,m,ans;
char s[N][N];
bool check1(int x,int y) {
if(y>m-2) return 0;
if(s[x][y]!='R') return 0;
if(s[x][y+1]!='G') return 0;
if(s[x][y+2]!='W') return 0;
s[x][y]=s[x][y+1]=s[x][y+2]='X';
return 1;
}
bool check2(int x,int y) {
if(x>n-2) return 0;
if(s[x][y]!='R') return 0;
if(s[x+1][y]!='G') return 0;
if(s[x+2][y]!='W') return 0;
s[x][y]=s[x+1][y]=s[x+2][y]='X';
return 1;
}
signed main() {
n=read(), m=read();
rep(i,1,n) scanf("%s",s[i]+1);
rep(i,1,n) rep(j,1,m) ans+=check1(i,j);
rep(i,1,n) rep(j,1,m) ans+=check2(i,j);
printf("%lld\n",ans);
return 0;
}
詳細信息
Subtask #1:
score: 13
Accepted
Test #1:
score: 13
Accepted
time: 3ms
memory: 3716kb
input:
1 1 G
output:
0
result:
ok single line: '0'
Test #2:
score: 0
Accepted
time: 3ms
memory: 3788kb
input:
1 2 RG
output:
0
result:
ok single line: '0'
Test #3:
score: 0
Accepted
time: 3ms
memory: 3792kb
input:
2 1 W R
output:
0
result:
ok single line: '0'
Test #4:
score: 0
Accepted
time: 2ms
memory: 3688kb
input:
3 2 WW RW WR
output:
0
result:
ok single line: '0'
Test #5:
score: 0
Accepted
time: 3ms
memory: 3828kb
input:
4 4 GRRW GWWR WWWW RGRG
output:
0
result:
ok single line: '0'
Test #6:
score: 0
Accepted
time: 2ms
memory: 3716kb
input:
4 4 RGRR RRRG GRGW RGWW
output:
2
result:
ok single line: '2'
Test #7:
score: 0
Accepted
time: 3ms
memory: 3824kb
input:
4 4 RRGR GRRG WRGW RGWW
output:
3
result:
ok single line: '3'
Test #8:
score: 0
Accepted
time: 2ms
memory: 3720kb
input:
4 4 RGWR GGGW WWGW RWGW
output:
1
result:
ok single line: '1'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3780kb
input:
3 3 RGW GGG WGW
output:
1
result:
ok single line: '1'
Test #10:
score: 0
Accepted
time: 2ms
memory: 3784kb
input:
4 1 W R G W
output:
1
result:
ok single line: '1'
Test #11:
score: 0
Accepted
time: 3ms
memory: 3656kb
input:
4 4 RGWR GWRG WRGW RGWR
output:
3
result:
ok single line: '3'
Test #12:
score: 0
Accepted
time: 3ms
memory: 3800kb
input:
4 4 RWWR GWRG WGGW RGWR
output:
3
result:
ok single line: '3'
Test #13:
score: 0
Accepted
time: 2ms
memory: 3772kb
input:
4 4 RGWR WWRG WRGW RWGR
output:
2
result:
ok single line: '2'
Test #14:
score: 0
Accepted
time: 0ms
memory: 3724kb
input:
4 4 RRRR GGGG WWWW RRRR
output:
4
result:
ok single line: '4'
Test #15:
score: 0
Accepted
time: 3ms
memory: 3788kb
input:
4 4 RRRR GGGR WWWW RRRR
output:
3
result:
ok single line: '3'
Test #16:
score: 0
Accepted
time: 2ms
memory: 3788kb
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: 2ms
memory: 3792kb
input:
5 5 RRGRR RGRGW RRWRW RGWGW RWWWW
output:
3
result:
ok single line: '3'
Test #18:
score: 0
Accepted
time: 2ms
memory: 3792kb
input:
6 6 RGWRGW RRRGWR RRWGWR WRRRWG GGGGGW WWWWWW
output:
7
result:
ok single line: '7'
Test #19:
score: -20
Wrong Answer
time: 2ms
memory: 3800kb
input:
7 10 RRRGRGWRGW RGGGWRRGWR RWWWWGRRGG RGWRWWGGGW WWRGWRGWGW RGWWGGRGWW RRGWWWWWWW
output:
13
result:
wrong answer 1st lines differ - expected: '14', found: '13'
Subtask #3:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%