QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#394560 | #7751. Palindrome Path | luanmenglei | WA | 1ms | 5756kb | C++17 | 3.6kb | 2024-04-20 16:12:07 | 2024-04-20 16:12:09 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
namespace SOL {
using i64 = long long;
void debug(const char *msg, ...) {
#ifdef CLESIP
va_list arg;
static char pbString[512];
va_start(arg,msg);
vsprintf(pbString,msg,arg);
cerr << "[DEBUG] " << pbString << "\n";
va_end(arg);
#endif
}
template<typename T, typename L>
bool chkmax(T &x, L y) { if (x < y) return x = y, true; return false; }
template<typename T, typename L>
bool chkmin(T &x, L y) { if (y < x) return x = y, true; return false; }
const int N = 35;
const int dx[] = { 1, -1, 0, 0 };
const int dy[] = { 0, 0, 1, -1 };
const int neg[] = { 1, 0, 3, 2 };
const char wrd[] = { 'D', 'U', 'R', 'L' };
int n, m;
char pic[N][N];
array<int, 2> st, ed, bst;
bool tvis[N][N], vis[N][N][N][N];
array<int, 5> lst[N][N][N][N];
vector<int> travel;
queue<array<int, 4>> q;
void dfs(int x, int y) {
tvis[x][y] = true;
for (int i = 0; i < 4; i ++) {
int xx = x + dx[i], yy = y + dy[i];
if (xx >= 1 && yy >= 1 && xx <= n && yy <= m && !tvis[xx][yy] && pic[xx][yy] == '1') {
travel.push_back(i);
dfs(xx, yy);
travel.push_back(neg[i]);
}
}
}
bool check(int xx, int yy) {
return xx >= 1 && yy >= 1 && xx <= n && yy <= m && pic[xx][yy] == '1';
}
array<int, 2> walk(int x, int y, int op) {
int xx = x + dx[op], yy = y + dy[op];
if (!check(xx, yy))
return { x, y };
return { xx, yy };
}
void bfs() {
lst[st[0]][st[1]][ed[0]][ed[1]][0] = -1;
vis[st[0]][st[1]][ed[0]][ed[1]] = true;
q.push({ st[0], st[1], ed[0], ed[1] });
while (!q.empty()) {
auto [x, y, u, v] = q.front(); q.pop();
// debug("vis (%d, %d, %d, %d)", x, y, u, v);
if (x == u && y == v) {
vector<int> ans;
while (lst[x][y][u][v][0] != -1) {
auto [op, xx, yy, uu, vv] = lst[x][y][u][v];
ans.push_back(op);
x = xx, y = yy, u = uu, v = vv;
}
for (int i = int(travel.size()) - 1; i >= 0; i --)
cout << wrd[travel[i]], bst = walk(bst[0], bst[1], travel[i]);
cerr << "\n";
for (int i = int(ans.size()) - 1; i >= 0; i --)
cout << wrd[ans[i]], bst = walk(bst[0], bst[1], ans[i]);
cerr << "\n";
for (int i = 0; i < int(ans.size()); i ++)
cout << wrd[ans[i]], bst = walk(bst[0], bst[1], ans[i]);
cerr << "\n";
for (int i = 0; i < int(travel.size()); i ++)
cout << wrd[travel[i]], bst = walk(bst[0], bst[1], travel[i]);
cerr << "\n";
debug("bst: (%d, %d)", bst[0], bst[1]);
return;
}
auto go = [&](int xx, int yy, int uu, int vv, int op) {
if (!vis[xx][yy][uu][vv]) {
vis[xx][yy][uu][vv] = true;
q.push({ xx, yy, uu, vv });
lst[xx][yy][uu][vv] = { op, x, y, u, v };
}
};
for (int i = 0; i < 4; i ++) {
int uu = u + dx[i], vv = v + dy[i];
auto [xx, yy] = walk(x, y, i);
auto [wu, wv] = walk(u, v, neg[i]);
if (!check(uu, vv))
go(xx, yy, u, v, i);
go(xx, yy, wu, wv, i);
}
}
cout << "-1\n";
cout << "????\n";
// assert(false);
}
void solve() {
cin >> n >> m;
for (int i = 1; i <= n; i ++)
cin >> (pic[i] + 1);
cin >> st[0] >> st[1] >> ed[0] >> ed[1];
dfs(ed[0], ed[1]);
bst = st;
for (int i = 1; i <= n; i ++)
for (int j = 1; j <= m; j ++)
if (!tvis[i][j] && pic[i][j] == '1')
return cout << "-1\n", void();
for (int i = int(travel.size()) - 1; i >= 0; i --)
st = walk(st[0], st[1], travel[i]);
debug("st (%d, %d)", st[0], st[1]);
bfs();
for (int i = 0; i < (int) travel.size(); i ++) {
ed = walk(ed[0], ed[1], travel[i]);
debug("(%d, %d)", ed[0], ed[1]);
}
}
}
int main() {
ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
SOL::solve();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 5592kb
input:
2 2 11 11 1 1 2 2
output:
DRUDLUDRRDULDURD
result:
ok Valid Solution (Length = 16).
Test #2:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
2 2 10 01 1 1 2 2
output:
-1
result:
ok No Solution.
Test #3:
score: 0
Accepted
time: 0ms
memory: 3528kb
input:
1 1 1 1 1 1 1
output:
result:
ok Valid Solution (Length = 0).
Test #4:
score: 0
Accepted
time: 1ms
memory: 3712kb
input:
5 4 1111 1111 1111 1111 1111 4 2 4 2
output:
ULDDDDRUURDDUUUUDDLDDLLUUUUDDDDRUUUURDDRLLLLRDDRUUUURDDDDUUUULLDDLDDUUUUDDRUURDDDDLU
result:
ok Valid Solution (Length = 84).
Test #5:
score: 0
Accepted
time: 1ms
memory: 4004kb
input:
5 5 11111 10101 11111 10101 11111 1 4 5 5
output:
DDDDRRUULRUURRDDLRDDLRUUUULLLRDDDDLLUUUUDDRRRRDDUUUULLDDDDRLLLUUUURLDDRLDDRRUURLUURRDDDD
result:
ok Valid Solution (Length = 88).
Test #6:
score: 0
Accepted
time: 1ms
memory: 3616kb
input:
5 3 111 100 111 001 111 4 3 3 2
output:
RDDLLRRUULLUURRLLDDRRDDLLRRUULLUURRLLDDR
result:
ok Valid Solution (Length = 40).
Test #7:
score: 0
Accepted
time: 0ms
memory: 3928kb
input:
5 4 1001 1101 1111 0011 0010 2 2 1 1
output:
UULLULDDDUUURUDDRDURDDULLUDDRUDRDDURUUUDDDLULLUU
result:
ok Valid Solution (Length = 48).
Test #8:
score: 0
Accepted
time: 1ms
memory: 3680kb
input:
5 3 101 111 100 111 100 4 1 2 2
output:
RDUUULLRRUDDDLLDURRUULLUURRUDLLDDDURRLLUUUDR
result:
ok Valid Solution (Length = 44).
Test #9:
score: 0
Accepted
time: 1ms
memory: 3728kb
input:
5 5 01110 10110 11110 11011 11100 2 4 5 1
output:
DDLLDDRLLUUULRDDDRUURUULRDDRDUUUDDLULLULDDUUUDRDDRLUURUURDDDRLUUULLRDDLLDD
result:
ok Valid Solution (Length = 74).
Test #10:
score: 0
Accepted
time: 0ms
memory: 3676kb
input:
5 3 011 111 110 111 011 3 1 2 1
output:
UULDDDLUDRUUUULDURDRDDLLDDRDRUDLUUUURDULDDDLUU
result:
ok Valid Solution (Length = 46).
Test #11:
score: 0
Accepted
time: 1ms
memory: 3948kb
input:
4 5 11111 11111 11111 11111 3 2 1 3
output:
UUURDDDRUUUDDDLUUULLDDDLUUUDDDRUUURDDDUUUUDDDRUUURDDDUUULDDDLLUUULDDDUUURDDDRUUU
result:
ok Valid Solution (Length = 80).
Test #12:
score: 0
Accepted
time: 1ms
memory: 5756kb
input:
5 5 11111 10101 11111 10101 11111 2 5 1 1
output:
UUUULLDDRLDDRLLLUURLUURLDDDDRRUUUURRDDDDUULLLLUUDDDDRRUUUURRDDDDLRUULRUULLLRDDLRDDLLUUUU
result:
ok Valid Solution (Length = 88).
Test #13:
score: 0
Accepted
time: 0ms
memory: 3864kb
input:
4 5 11111 10000 11111 00001 1 3 4 5
output:
DRRRRDDLLLLRRRRUULLLLUDDRRRRDDULLLLUURRRRLLLLDDRRRRD
result:
ok Valid Solution (Length = 52).
Test #14:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
3 5 10100 00010 00111 1 3 1 1
output:
-1
result:
ok No Solution.
Test #15:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
4 5 10001 11111 11100 11111 4 5 3 1
output:
ULDDRDULLLLDURRUULLRRDDRUURDULLLLUDRUURDDRRLLUURRUDLLLLUDRDDLU
result:
ok Valid Solution (Length = 62).
Test #16:
score: 0
Accepted
time: 0ms
memory: 3676kb
input:
3 5 11111 10100 11111 1 2 3 5
output:
RRDDRRUULRDDLLLLRRUULLRRDDRRLLUURRLLLLDDRLUURRDDRR
result:
ok Valid Solution (Length = 50).
Test #17:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
4 5 01110 10101 11011 10111 1 3 2 3
output:
-1
result:
ok No Solution.
Test #18:
score: 0
Accepted
time: 1ms
memory: 3768kb
input:
5 5 11111 11111 11111 11111 11111 1 3 5 2
output:
DDDDRUUUUDDDDLLUUUULDDDDLUUUUDDDDRUUUURDDDDRUUUUDDLLDDUUUURDDDDRUUUURDDDDUUUULDDDDLUUUULLDDDDUUUURDDDD
result:
ok Valid Solution (Length = 102).
Test #19:
score: 0
Accepted
time: 1ms
memory: 3664kb
input:
5 5 11111 10101 11111 10101 11111 5 1 2 3
output:
UUULLDDRLDDRRRRUULRUULRDDDDLLLLUUUURRDDDUUDDDRRUUUULLLLDDDDRLUURLUURRRRDDLRDDLLUUU
result:
ok Valid Solution (Length = 82).
Test #20:
score: 0
Accepted
time: 1ms
memory: 3708kb
input:
5 5 11111 10000 11111 00001 11111 4 5 5 3
output:
RRLLLLDDRRRRDDLLLLRRRRUULLLLUURRLLDDRRRRDDLLRRUULLLLUURRRRLLLLDDRRRRDDLLLLRR
result:
ok Valid Solution (Length = 76).
Test #21:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
5 5 01010 10101 10101 11001 10011 4 1 5 4
output:
-1
result:
ok No Solution.
Test #22:
score: 0
Accepted
time: 1ms
memory: 3756kb
input:
5 5 10101 11111 10101 11111 11111 3 1 2 4
output:
LDUUUURDRURDRDDLLDUUDRRDUUUUDLULDLULDDDRURUURURDDDLULDLULDUUUUDRRDUUDLLDDRDRURDRUUUUDL
result:
ok Valid Solution (Length = 86).
Test #23:
score: 0
Accepted
time: 1ms
memory: 3904kb
input:
5 5 00001 11111 01110 01111 01111 1 5 5 2
output:
DDDRLLUUULDLUDRDDLDURUUURDDDRUUUDLLLLDUUURDDDRUUURUDLDDRDULDLUUULLRDDD
result:
ok Valid Solution (Length = 70).
Test #24:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
5 5 01011 10111 11011 10101 01110 4 1 2 3
output:
-1
result:
ok No Solution.
Test #25:
score: 0
Accepted
time: 1ms
memory: 4560kb
input:
10 8 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 7 7 3 6
output:
UUUUUUULDDDDDDDDDRURUUUUUUUURDDDDDDDDDRUUUUUUUUURDDDDDDDDDRUUUUUUUUUDDDDDDDDDLUUUUUUUUULDDDDDDDDDLLRUUUUUUUUULDDDDDDDDLDLLUUUUUUUUUDDDDDDDDDRUUUUUUUUURDDDDDDDDDUUUUULLRRRRRRRRLLUUUUUDDDDDDDDDRUUUUUUUUURDDDDDDDDDUUUUUUUUULLDLDDDDDDDDLUUUUUUUUURLLDDDDDDDDDLUUUUUUUUULDDDDDDDDDUUUUUUUUURDDDDDDDDDRUUUUUU...
result:
ok Valid Solution (Length = 342).
Test #26:
score: 0
Accepted
time: 1ms
memory: 3988kb
input:
10 6 111111 101010 111111 101010 111111 101010 111111 101010 111111 101010 1 6 2 3
output:
UUUUUUULLLRDDRLLRDDRLLRDDRLLRDDRRRRUULRUULRUULRUULRUDDDDDDDDDLLLLLRUUUUUUUUUDRRUDDDDDDDDLDUUDLDDDDDDDDURRDUUUUUUUUURLLLLLDDDDDDDDDURLUURLUURLUURLUURRRRDDRLLRDDRLLRDDRLLRDDRLLLUUUUUUU
result:
ok Valid Solution (Length = 182).
Test #27:
score: 0
Accepted
time: 1ms
memory: 3728kb
input:
10 10 1111111111 1000000000 1111111111 0000000001 1111111111 1000000000 1111111111 0000000001 1111111111 1000000000 5 5 5 2
output:
RUULLLLLLLLLUURRRRRRRRRUDLLLLLLLLLDDRRRRRRRRRDDLLLLLLLLLDDRRRRRRRRRDDLLLLLLLLLRRRRRRRRRUULLLLLLLLLUURRRRRRRRRUULLLLLLLLLLUURRRRRRRRRUULLLLLLLLLUURRRRRRRRRLLLLLLLLLDDRRRRRRRRRDDLLLLLLLLLDDRRRRRRRRRDDLLLLLLLLLDURRRRRRRRRUULLLLLLLLLUUR
result:
ok Valid Solution (Length = 232).
Test #28:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
10 10 1010110101 0000011010 1001001001 0011111000 1000111100 1011101001 1100110011 0110001011 0011111000 0101011101 7 5 4 3
output:
-1
result:
ok No Solution.
Test #29:
score: 0
Accepted
time: 1ms
memory: 4020kb
input:
10 6 100100 111111 100001 111111 101111 111111 101010 111111 111100 111111 6 5 7 3
output:
UUULLLRRDDLLRDDDDLDDRRRRRDUUUUULLDDRLLUUDDRUURRUUUULDDUURDDDDDDDDLLLDULLUUUUDDRUUUURUURDDDDULDDLUDDDDRUURUUUURDDUUUULLUDLLLDDDDDDDDRUUDDLUUUURRUURDDUULLRDDLLUUUUUDRRRRRDDLDDDDRLLDDRRLLLUUU
result:
ok Valid Solution (Length = 188).
Test #30:
score: 0
Accepted
time: 1ms
memory: 4052kb
input:
10 8 11111110 11110111 01111111 11111101 11011101 11111111 11111011 11011101 11001111 11111110 7 1 2 1
output:
DLUUUUUUUUURDDDDDDUUUUUULLLLDDDDDDDLUUULULDDDDDRDRRRUUURDDDUUULUUURDULUDDDDDDDLLUDLUUDLUUUUUUURURDDUULDLDDRDRDDDRUUUUUUURRRDDDDDDDDDRULUULLUUUULLUULURDDDDDDDDDRRRUUUUUUURDDDRDRDDLDLUUDDRURUUUUUUULDUULDULLDDDDDDDULUDRUUULUUUDDDRUUURRRDRDDDDDLULUUULDDDDDDDLLLLUUUUUUDDDDDDRUUUUUUUUULD
result:
ok Valid Solution (Length = 282).
Test #31:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
10 10 1111011101 1110111110 1111011111 1011101111 0101010111 1110111111 0111010111 1011111011 0111010101 1011111110 2 6 7 4
output:
-1
result:
ok No Solution.
Test #32:
score: 0
Accepted
time: 1ms
memory: 4172kb
input:
8 10 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 8 10 6 10
output:
UURDDDDDDDRUUUUUUURDDDDDDDRUUUUUUURDDDDDDDRUUUUUUURDDDDDDDRUUUUUUURDDDDDDDUUUUUUULDDDDDDDLUUUUUUULDDDDDDDLUUUUUUULDDDDDDDLUUUUUUULDDDDDDDLLUUUUDDDDRUUUUUUULDDUUDDDDRRRRRRRRRRDDDDUUDDLUUUUUUURDDDDUUUULLDDDDDDDLUUUUUUULDDDDDDDLUUUUUUULDDDDDDDLUUUUUUULDDDDDDDLUUUUUUUDDDDDDDRUUUUUUURDDDDDDDRUUUUUUURDDDD...
result:
ok Valid Solution (Length = 338).
Test #33:
score: 0
Accepted
time: 1ms
memory: 4048kb
input:
10 10 1111111111 1010101010 1111111111 1010101010 1111111111 1010101010 1111111111 1010101010 1111111111 1010101010 3 5 9 1
output:
DDDDDDDDLLUURLUURLUURLUURLLLDDRLDDRLDDRLDDRLLLUURLUURLUURLUURLLLLRDDRLLRDDRLLRDDRLLRDDRLLRUUUUUUUUUDRRUDDDDDDDDDRRUUUUUUUUUDRRUDDDDDDDDDRRUUUUUUUUUDDDDLDLLLLDLDDDDUUUUUUUUURRDDDDDDDDDURRDUUUUUUUUURRDDDDDDDDDURRDUUUUUUUUURLLRDDRLLRDDRLLRDDRLLRDDRLLLLRUULRUULRUULRUULLLRDDLRDDLRDDLRDDLLLRUULRUULRUULRUU...
result:
ok Valid Solution (Length = 310).
Test #34:
score: 0
Accepted
time: 1ms
memory: 3756kb
input:
10 10 1111111111 1000000000 1111111111 0000000001 1111111111 1000000000 1111111111 0000000001 1111111111 1000000000 5 4 7 2
output:
RDDLLLLLLLLLDDRRRRRRRRRDDLLLLLLLLLRRRRRRRRRUULLLLLLLLLUURRRRRRRRRUULLLLLLLLLUURRRRRRRRRUDLLLLLLLLLDDRRRRRRRRRDDLLLLLLLLLLDDRRRRRRRRRDDLLLLLLLLLDURRRRRRRRRUULLLLLLLLLUURRRRRRRRRUULLLLLLLLLUURRRRRRRRRLLLLLLLLLDDRRRRRRRRRDDLLLLLLLLLDDR
result:
ok Valid Solution (Length = 232).
Test #35:
score: 0
Accepted
time: 0ms
memory: 3520kb
input:
9 10 1111001000 1110010111 0001001000 0101000101 1101000001 0111100110 0010010000 0001001000 1011001101 2 8 5 2
output:
-1
result:
ok No Solution.
Test #36:
score: 0
Accepted
time: 1ms
memory: 3956kb
input:
5 10 1001011101 1111111111 1000011001 1111111111 1101110010 4 3 4 7
output:
DDDRUUUURDRRRURDDDLLLLRDURRRDUUUULDLLUDLULDDDDLLULLDUUURRLUDLDDRRDRUUUDRURRURDUUURDRRDDLDULRRUUUDLLULLDDDDLULDULLDLUUUUDRRRUDRLLLLDDDRURRRDRUUUURDDD
result:
ok Valid Solution (Length = 148).
Test #37:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
7 10 1111111001 1111101110 1111011111 1101011101 1111011111 1111001011 1111111011 7 10 7 2
output:
-1
result:
ok No Solution.
Test #38:
score: 0
Accepted
time: 1ms
memory: 3900kb
input:
9 10 0101011101 1111111111 0101111111 1111111111 1111110101 1011111111 1101111101 1111111011 1101011111 3 7 7 10
output:
UURRRDDDLDDDDLUULDDDUUUUURLDDRDDRDRUUURUUUURDDDDDDRDUUUUUUURRURDDLRDDDLDDRLLRDUUUULDUUDRDRUUUUULDLLUDDDDDDDLLDUUDRUUUUUULUDDDDDLDDDLUUUUUUDRUUULLDULDDDRRDDRRDDDLUDLLUUURDUUUUUULDDDLDDDDDULUUUUUURDUUDLLDDDDDDDULLDLUUUUURDRDUUDLUUUUDRLLRDDLDDDRLDDRURRUUUUUUUDRDDDDDDRUUUURUUURDRDDRDDLRUUUUUDDDLUULDDDDL...
result:
ok Valid Solution (Length = 308).
Test #39:
score: 0
Accepted
time: 1ms
memory: 4672kb
input:
10 10 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 9 5 3 2
output:
UUUUUUULDDDDDDDDDRURDUUUUUUUUUDDDDDDDDLDLLUUUUUUUUULDDDDDDDDDLUUUUUUUUULDDDDDDDDDLUUUUUUUUULDDDDDDDDDLUUUUUUUUUDDDDDDDDDRUUUUUUUUURDDDDDDDDDRUUUUUUUUURDDDDDDDDDRUUUUUUUUURDDDDDDDDDRUUUUUUUUURDDDDDDDDDUUUUURLLLLLLLLLLRUUUUUDDDDDDDDDRUUUUUUUUURDDDDDDDDDRUUUUUUUUURDDDDDDDDDRUUUUUUUUURDDDDDDDDDRUUUUUUUU...
result:
ok Valid Solution (Length = 422).
Test #40:
score: 0
Accepted
time: 1ms
memory: 3808kb
input:
10 10 1111111111 1010101010 1111111111 1010101010 1111111111 1010101010 1111111111 1010101010 1111111111 1010101010 2 1 1 3
output:
UUUUUUUURRDDLRDDLRDDLRDDLRUUUUUUUUUDLLLLDDRLDDRLDDRLDDRLLLUURLUURLUURLUURLLLLRDDRLLRDDRLLRDDRLLRDDRLLRUUUUUUUUUDRRUDDDDDDDDDRRUUUUUUUUUDRRUDDDDDDDDDUUUUUUUUUUDDDDDDDDDURRDUUUUUUUUURRDDDDDDDDDURRDUUUUUUUUURLLRDDRLLRDDRLLRDDRLLRDDRLLLLRUULRUULRUULRUULLLRDDLRDDLRDDLRDDLLLLDUUUUUUUUURLDDRLDDRLDDRLDDRRUU...
result:
ok Valid Solution (Length = 306).
Test #41:
score: 0
Accepted
time: 1ms
memory: 3860kb
input:
10 10 1111111111 1000000000 1111111111 0000000001 1111111111 1000000000 1111111111 0000000001 1111111111 1000000000 7 4 3 5
output:
RRRRDDLLLLLLLLLRRRRRRRRRUULLLLLLLLLUURRRRRRRRRUULLLLLLLLLUURRRRRRRRRUDLLLLLLLLLDDRRRRRRRRRDDLLLLLLLLLDDRRRRRLLLLLUURRRRRRRRRRUULLLLLRRRRRDDLLLLLLLLLDDRRRRRRRRRDDLLLLLLLLLDURRRRRRRRRUULLLLLLLLLUURRRRRRRRRUULLLLLLLLLUURRRRRRRRRLLLLLLLLLDDRRRR
result:
ok Valid Solution (Length = 240).
Test #42:
score: 0
Accepted
time: 0ms
memory: 3864kb
input:
10 10 1110000101 1100110001 1011011001 0000000111 0010010111 0100111011 1110010011 1100111111 0110001110 0100000101 9 9 6 10
output:
-1
result:
ok No Solution.
Test #43:
score: -100
Wrong Answer
time: 0ms
memory: 3944kb
input:
10 10 1110111011 1111111111 1110110000 1111111111 1010011100 1111111111 1111001110 1111111111 1001010011 1111111111 6 9 2 9
output:
RRDRUUUUULUULDDLLRUUUURRRDDRRUURRRDDDDDDDDDLUUULDDLLDUUURLDDRRDUUUUUULDLRURURDDUULDDDDRDDDRUUUUUUUUULLLLRDDLLUULLLLDDUURDDDDRDDRUDLLLRRUUUURDDRDDDDDLULLDLUDRURRURRRRURRURDULDLLULDDDDDRDDRUUUURRLLLDURDDRDDDDRUUDDLLLLUULLDDRLLLLUUUUUUUUURDDDRDDDDLUUDDRURURLDLUUUUUUDRRDDLRUUUDLLDDLUUULDDDDDDDDDRRRUURRD...
result:
wrong answer (1,9) Not Visited