# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
915701 | Alcabel | Robots (APIO13_robots) | C++17 | 131 ms | 134228 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int maxc = 500, maxn = 10;
const int deltaX[4] = {0, -1, 0, 1}, deltaY[4] = {1, 0, -1, 0};
char t[maxc][maxc];
pair<int, int> dest[maxc][maxc][4];
char vis[maxc][maxc][4];
int w, h;
pair<int, int> getDest(int x, int y, int dir) {
if (vis[x][y][dir] == 1) {
dest[x][y][dir] = {-1, -1};
return {-1, -1};
}
if (vis[x][y][dir] == 2) {
return dest[x][y][dir];
}
vis[x][y][dir] = 1;
int newDir = dir;
if (t[x][y] == 'A') {
newDir = (dir < 3 ? dir + 1 : 0);
} else if (t[x][y] == 'C') {
newDir = (dir > 0 ? dir - 1 : 3);
}
int newX = x + deltaX[newDir], newY = y + deltaY[newDir];
if (newX < 0 || newX >= h || newY < 0 || newY >= w || t[newX][newY] == 'x') {
dest[x][y][dir] = {x, y};
} else {
dest[x][y][dir] = getDest(newX, newY, newDir);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |