QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#499470 | #6723. Grid with Arrows | ziripo | WA | 0ms | 3796kb | C++20 | 1.1kb | 2024-07-31 14:40:51 | 2024-07-31 14:40:52 |
Judging History
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;
}
詳細信息
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]