QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#480339 | #8742. 黑白 | huaxiamengjin | WA | 46ms | 5624kb | C++14 | 716b | 2024-07-16 14:11:02 | 2024-07-16 14:11:02 |
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<<"L"<<"\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<<"L"<<"\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();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 46ms
memory: 5624kb
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:
L L L I I L I L L J L J J L L L L L I L L J I I I J L I J L L L I L L L J J L I L J I I L L L I J J J I J I L J L J L L J L J I L L I L I L J L J I J L L L J L L J L J J I J J L I I L L L L J L J J L
result:
wrong answer 1st lines differ - expected: 'J', found: 'L'