QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#499503 | #6723. Grid with Arrows | ziripo | WA | 163ms | 9272kb | C++20 | 1.0kb | 2024-07-31 15:01:02 | 2024-07-31 15:01:03 |
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;
}
}
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: 3732kb
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: 163ms
memory: 9272kb
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]