# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
207662 | PeppaPig | Robots (APIO13_robots) | C++14 | 1010 ms | 59996 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>
#define pii pair<int, int>
#define x first
#define y second
using namespace std;
const int N = 505;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, -1, 0, 1};
struct item {
int r, c, id;
item(int r, int c, int id) : r(r), c(c), id(id) {}
};
int n, w, h, mp[10][10], dp[45][N][N];
char A[N][N];
pii nex[4][N][N];
vector<item> process[45];
pii find_next(int r, int c, int dir) {
if(nex[dir][r][c] == pii(-1, -1) && A[r][c] != 'x') {
int ndir = dir;
if(A[r][c] == 'C') ndir = (dir + 1) % 4;
if(A[r][c] == 'A') ndir = (dir + 3) % 4;
int nr = r + dx[ndir], nc = c + dy[ndir];
if(nr < 1 || nr > h || nc < 1 || nc > w || A[nr][nc] == 'x')
nex[dir][r][c] = pii(r, c);
Compilation message (stderr)
# | 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... |