# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1012844 | ttamx | Robots (APIO13_robots) | C++17 | 865 ms | 55452 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 N=10;
const int H=500;
const int INF=1e9;
int n,h,w;
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
string a[H];
pair<int,int> pos[H][H][4];
bool vis[H][H][4];
int dp[N][N][H][H];
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))pos[i][j][d]={i,j};
return pos[i][j][d];
}
int main(){
cin.tie(nullptr)->sync_with_stdio(false);
cin >> n >> w >> h;
# | 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... |