QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#480340 | #8742. 黑白 | huaxiamengjin | WA | 46ms | 5540kb | C++14 | 716b | 2024-07-16 14:12:03 | 2024-07-16 14:12:03 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int n,m;
char a[1010][1010];
bool f[1010][1010];
void solve(){
cin>>n>>m;
for (int i=1;i<=n;i++)
for (int j=1;j<=m;j++)
cin>>a[i][j];
if(a[1][1]=='B'||a[n][m]=='B')
return cout<<"J"<<"\n",void();
f[1][1]=1;
for (int i=1;i<=n;i++)
for (int j=1;j<=m;j++)
if((i!=1||j!=1)&&a[i][j]=='W')
f[i][j]=f[i-1][j]|f[i][j-1];
else if(a[i][j]=='B')f[i][j]=0;
if(f[n][m]==0)return cout<<"J"<<"\n",void();
int ct=0;
for (int i=1;i<=n;i++)
for (int j=1;j<=m;j++)
ct+=(a[i][j]=='W');
ct-=(n+m-1);
if(ct&1)cout<<"I\n";
else cout<<"J\n";
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
int T;cin>>T;
while(T--)solve();
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 46ms
memory: 5540kb
input:
100 2 6 WWBBWW WWWWWB 3 8 WWWBBBBB WWWBWWWB BBWWWBWW 5 2 WB BB BB BW BB 6 4 WWBW WBWB WWWW WWWB BBWW BWBW 2 3 WWW WBW 124 125 BWWWWWWWWWWWWWWWWWWWWWWWWWWBWWWWBWWWWWWWWBWWWWWWWWWWWBBBBWWWWWWWWWWWWWWWWWBWWWWWWWWWBWWWWWWWWWWBWWWWWWWWBBWWWWWWWWWWWWWWWWWWB WWWWWWWBWWBWWWWWWWWWWWBWWBWWBWWWWBWWWWWWWWWBWBWB...
output:
J J J I I J I J J J J J J J J J J J I J J J I I I J J I J J J J I J J J J J J I J J I I J J J I J J J I J I J J J J J J J J J I J J I J I J J J J I J J J J J J J J J J J I J J J I I J J J J J J J J J
result:
wrong answer 8th lines differ - expected: 'I', found: 'J'