QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#384154#3742. 卖萌表情NYOJ-3WA 48ms5660kbC++171.5kb2024-04-09 20:54:242024-04-09 20:54:24

Judging History

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

  • [2024-04-09 20:54:24]
  • 评测
  • 测评结果:WA
  • 用时:48ms
  • 内存:5660kb
  • [2024-04-09 20:54:24]
  • 提交

answer

#include<iostream>
#include<string.h>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<vector>
using namespace std;
#define int long long
const int N=1010;
int n,m;
char c[N][N];
bool bi[N][N];//标记当前位置有没有被用过
int cnt;
signed main()
{
	while(cin>>n>>m)
	{
//		memset(bi,0,sizeof bi);
		cnt=0;
		for(int i=1;i<=n;i++)
		{
			for(int j=1;j<=m;j++)
			{
				cin>>c[i][j];
				bi[i][j]=0;
			}
		}
		for(int i=1;i<=n;i++)
		{
			for(int j=1;j<=m;j++)
			{
				if(!bi[i][j])
				{
					if(c[i][j]=='^')
					{
						if((i+1)<=n&&(j+2)<=m&&c[i+1][j+1]=='v'&&c[i][j+2]=='^'&&!bi[i+1][j+1]&&!bi[i][j+2])
						{
							bi[i][j]=1;
							bi[i+1][j+1]=1;
							bi[i][j+2]=1;
							cnt++;
						}
					}
					else if(c[i][j]=='v')
					{
						if((i-1)>0&&(j+2)<=m&&c[i-1][j+1]=='^'&&c[i][j+2]=='v'&&!bi[i-1][j+1]&&!bi[i][j+2])
						{
							bi[i][j]=1;
							bi[i-1][j+1]=1;
							bi[i][j+2]=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++;
						}
					}
					else if(c[i][j]=='>')
					{
						if((i-1)>0&&(i+1)<=n&&(j-1)>0&&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: 48ms
memory: 5660kb

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
4
6
3
5
4
9
2
0
4
6
6
4
0
5
0
16
6
2
6
2
5
4
10
4
8
0
0
10
0
4
5
6
4
12
12
2
0
13
4
4
6
6
5
0
5
0
6
6
2
11
0
11
4
0
2
0
0
11
18
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
16
6
4
12
0
0
8
5
12
0
5
9
4
2
0...

result:

wrong answer 4th numbers differ - expected: '6', found: '4'