QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#499472#6723. Grid with ArrowsziripoWA 154ms9468kbC++201.0kb2024-07-31 14:41:382024-07-31 14:41:46

Judging History

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

  • [2024-07-31 14:41:46]
  • 评测
  • 测评结果:WA
  • 用时:154ms
  • 内存:9468kb
  • [2024-07-31 14:41:38]
  • 提交

answer

#include<bits/stdc++.h>

using namespace std;

vector<vector<char>> x;
vector<vector<int>> f;

int main() {
	int t; cin >> t;
	for (int i = 0; i < t; i++) {
		int n, m; scanf("%d%d", &n, &m);
		vector<vector<char>> x(n, vector<char>(m, 0));
		vector<vector<int>> f(n, vector<int>(m, 0));
		int t = 0, s, xt = 0, yt = 0;
		for (int i = 0; i < n; i++)for (int j = 0; j < m; j++)cin >> x[i][j];
		for (int i = 0; i < n; i++)for (int j = 0; j < m; j++) {
			cin >> s;
			int p, q;
			if (x[i][j] == 'u') {
				p = i - s;
				q = j;
			}
			if (x[i][j] == 'd') {
				p = i + s;
				q = j;
			}
			if (x[i][j] == 'r') {
				p = i;
				q = j + s;
			}
			if (x[i][j] == 'l') {
				p = i;
				q = j - s;
			}
			if (p >= 0 && p < n && q >= 0 && q < m) {
				if (!f[p][q]) {
					t++;
					f[p][q] = 1;
				}
			}
			else {
				xt = i;
				yt = j;
			}
		}
		if (n * m == 1)
			printf("Yes\n");
		else if (t >= n * m - 1 && f[xt][yt])
			printf("Yes\n");
		else
			printf("No\n");
	}
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3768kb

input:

2
2 3
rdd
url
2 1 1
1 1 2
2 2
rr
rr
1 1
1 1

output:

Yes
No

result:

ok 2 token(s): yes count is 1, no count is 1

Test #2:

score: -100
Wrong Answer
time: 154ms
memory: 9468kb

input:

1109
5 8
rddddldl
drruludl
rrldrurd
urrrlluu
uurrulrl
4 4 1 2 4 3 1 6
1 3 5 1 1 1 3 6
2 4 1 1 2 1 1 1
2 3 4 2 4 3 3 3
4 1 1 2 2 5 1 5
7 9
rdrddrdll
urrdruldl
ruullrulu
drrlrlddl
rrrdddlll
ruulururl
ruurrlluu
7 1 1 1 2 1 2 3 6
1 7 3 1 3 1 2 1 8
2 2 1 2 4 3 1 2 2
2 2 4 1 1 5 3 3 1
3 4 6 1 2 1 2 7 7
6 ...

output:

Yes
Yes
No
No
Yes
No
Yes
Yes
Yes
Yes
No
Yes
No
Yes
Yes
No
Yes
No
Yes
No
No
No
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
No
Yes
Yes
No
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
No
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
No
No
Yes
Yes
Yes
Yes
Ye...

result:

wrong answer expected NO, found YES [2nd token]