# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1093931 | Trisanu_Das | Robots (APIO13_robots) | C++17 | 15 ms | 10704 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 INF = 0x3f3f3f3f;
int N,W,H;
vector<string> G;
vector<vector<vector<int>>> dist;
vector<vector<vector<pair<int,int>>>> ma;
bool legal(int i, int j, int d){
if (d == 0 && (i+1 == H || G[i+1][j] == 'x')) return 0;
if (d == 1 && (j+1 == W || G[i][j+1] == 'x')) return 0;
if (d == 2 && (i == 0 || G[i-1][j] == 'x')) return 0;
if (d == 3 && (j == 0 || G[i][j-1] == 'x')) return 0;
return 1;
}
pair<int,int> move(int i, int j, int d){
int oi = i,oj = j,od = d;
while (1){
if (ma[i][j][d].first != -1) {
return ma[oi][oj][od] = ma[i][j][d];
}
if (G[i][j] == 'A') {
d++;
if (d == 4) d = 0;
}
if (G[i][j] == 'C'){
d--;
if (d == -1) d = 3;
}
if (!legal(i,j,d)) return ma[oi][oj][od] = {i,j};
if (d == 0) i++;
# | 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... |