# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1104271 | ALTAKEXE | Robots (APIO13_robots) | C++17 | 1 ms | 336 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 ll long long
#define ff first
#define ss second
#define inf INT_MAX
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FAR(i, a, b) for (int i = (a); i >= (b); i--)
#define all(x) (x.begin(), x.end())
const int INF = 1e9;
using namespace std;
int n, h, w;
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
string a[500];
pair<int, int> pos[500][500][4];
bool vis[500][500][4];
int dp[10][10][500][500];
pair<int, int> dfs(int i, int j, int d)
{
if (i < 0 || i >= h || j < 0 || j >= w || a[i][j] == 'x')
return {-1, -1};
if (vis[i][j][d])
return pos[i][j][d];
vis[i][j][d] = true;
int nd = d;
if (a[i][j] == 'C')
nd = (nd + 1) % 4;
if (a[i][j] == 'A')
nd = (nd + 3) % 4;
pos[i][j][d] = dfs(i + dx[nd], j + dy[nd], nd);
if (pos[i][j][d] == make_pair(-1, -1))
# | 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... |