QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#499470#6723. Grid with ArrowsziripoWA 0ms3796kbC++201.1kb2024-07-31 14:40:512024-07-31 14:40:52

Judging History

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

  • [2024-07-31 14:40:52]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3796kb
  • [2024-07-31 14:40:51]
  • 提交

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;
			}
		}
		cout << t << " " << xt << " " << yt << "\n";
		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;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3796kb

input:

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

output:

5 0 0
Yes
2 1 1
No

result:

wrong output format YES or NO expected, but 5 found [1st token]