# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
915694 | Alcabel | 로봇 (APIO13_robots) | C++17 | 1569 ms | 100784 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |