QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#499501 | #6723. Grid with Arrows | ziripo | WA | 0ms | 3728kb | C++20 | 1.1kb | 2024-07-31 15:00:15 | 2024-07-31 15:00:18 |
Judging History
answer
#include<bits/stdc++.h>
#define ll long long
using namespace std;
vector<vector<char>> x;
vector<vector<ll>> f;
int main() {
ll t; cin >> t;
for (ll i = 0; i < t; i++) {
ll n, m; scanf("%lld%lld", &n, &m);
vector<vector<char>> x(n, vector<char>(m));
vector<vector<ll>> f(n, vector<ll>(m, 0));
ll t = 0, s, xt = 0, yt = 0;
for (ll i = 0; i < n; i++)for (ll j = 0; j < m; j++)cin >> x[i][j];
for (ll i = 0; i < n; i++)for (ll j = 0; j < m; j++) {
cin >> s;
ll 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 && !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: 3728kb
input:
2 2 3 rdd url 2 1 1 1 1 2 2 2 rr rr 1 1 1 1
output:
5 1 1 Yes 2 1 1 No
result:
wrong output format YES or NO expected, but 5 found [1st token]