# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1154703 | dosts | Robots (APIO13_robots) | C++17 | 587 ms | 212096 KiB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pii pair<int,int>
#define ff first
#define ss second
#define sp << " " <<
#define all(cont) cont.begin(),cont.end()
#define vi vector<int>
const int inf = 2e9,N = 2e6+1,MOD = 998244353,B = 600;
vector<string> grid;
int dp[500][500][10][10];
pii go[500][500][4];
vi dx{0,1,0,-1},dy{1,0,-1,0};
int h,w;
pii dfs(int x,int y,int d){
if (go[x][y][d].ff != -2) return go[x][y][d];
if (grid[x][y] == 'x') return go[x][y][d] = {-1,-1};
int dd = d;
if (grid[x][y] == 'C') dd = (dd+1)%4;
if (grid[x][y] == 'A') dd = (dd+3)%4;
int gx = x+dx[dd],gy = y+dy[dd];
if (gx < 0 || gx >= h || gy < 0 || gy >= w || grid[gx][gy] == 'x') return go[x][y][d] = {x,y};
go[x][y][d] = {-1,-1};
return go[x][y][d] = dfs(gx,gy,dd);
# | 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... |