QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#384105 | #3742. 卖萌表情 | ucup-team1251 | WA | 120ms | 5624kb | C++17 | 1.4kb | 2024-04-09 20:45:37 | 2024-04-09 20:45:38 |
Judging History
answer
#include<iostream>
#include<string.h>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<vector>
using namespace std;
const int N=1010;
int n,m;
char c[N][N];
bool bi[N][N];//标记当前位置有没有被用过
int cnt;
signed main()
{
while(cin>>n>>m)
{
cnt=0;
memset(bi,0,sizeof bi);
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
cin>>c[i][j];
}
}
for(int i=0;i<n;i++){
for(int j=0;j<m;j++)
{
if(!bi[i][j])
{
if(c[i][j]=='^')
{
if((i+1)<n&&(j-1)>=0&&(j+1)<m&&c[i+1][j-1]=='v'&&c[i+1][j+1]=='v'&&!bi[i+1][j-1]&&!bi[i+1][j+1])
{
cnt++;
bi[i+1][j-1]=1;
bi[i+1][j+1]=1;
bi[i][j]=1;
}
}
else if(c[i][j]=='v')
{
if((i-1)>=0&&(j-1)>=0&&(j+1)<m&&c[i-1][j-1]=='^'&&c[i-1][j+1]=='^'&&!bi[i-1][j-1]&&!bi[i-1][j+1])
{
bi[i][j]=1;
bi[i-1][j-1]=1;
bi[i-1][j+1]=1;
cnt++;
}
}
else if(c[i][j]=='>'){
if((i-1)>=0&&(j-1)>=0&&(i+1)<n&&c[i-1][j-1]=='<'&&c[i+1][j-1]=='<'&&!bi[i-1][j-1]&&!bi[i+1][j-1]){
bi[i][j]=1;
bi[i-1][j-1]=1;
bi[i+1][j-1]=1;
cnt++;
}
}
else if(c[i][j]=='<')
{
if((i-1)>=0&&(i+1)<n&&(j+1)<m&&c[i-1][j+1]=='>'&&c[i+1][j+1]=='>'&&!bi[i-1][j+1]&&!bi[i+1][j+1])
{
bi[i][j]=1;
bi[i-1][j+1]=1;
bi[i+1][j+1]=1;
cnt++;
}
}
}
}
}
cout<<cnt<<endl;
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 120ms
memory: 5624kb
input:
3 10 ^>^<^^^^>^ <v^v^^v^v> <>vvvvvvvv 10 1 v ^ < < v < v > < < 5 4 <^^^ <vvv <<^> vv^v <vvv 2 9 ^^^^^^^^^ vvvvvvvvv 9 10 ^>^^<^<^<> <^<<><<<<> v^v^^<>^<^ ^<vvv<><<> <v>>><^v^> ^^^^>^^<<v v^v>v^v^<> v^vvv>v^<^ vvvvv><>v> 8 8 ^^^^<^<^ <>^<v>v^ <v<v>^v> v>v<vv<> ^<^>>v<> <v^v^<<> ^v^^>v<> <vv<vv<> 2 2 ...
output:
5 0 4 4 13 10 0 3 7 7 10 0 6 2 0 5 0 4 3 0 0 0 0 4 5 6 3 5 4 9 2 0 4 6 6 4 0 5 0 16 6 2 6 2 5 4 9 4 8 0 0 10 0 4 5 6 4 12 11 2 0 12 4 4 6 6 5 0 5 0 6 6 2 11 0 11 5 0 2 0 0 11 17 5 2 6 14 8 7 4 0 0 0 7 8 3 6 0 0 13 4 2 9 4 3 13 7 9 0 3 14 0 6 0 5 14 9 5 4 0 0 3 2 9 6 17 6 4 12 0 0 8 5 11 0 5 9 4 2 0 ...
result:
wrong answer 4th numbers differ - expected: '6', found: '4'