#include "robot.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define FOR(i,l,r) for(int i = (l), _r = (r); i <= _r; i++)
#define FORNG(i,r,l) for(int i = (r), _l = (l); i >= _l; i--)
#define REP(i,r) for(int i = 0, _r = (r); i < _r; i++)
#define endl '\n'
#define fi first
#define se second
#define pb push_back
#define size(v) ((ll)(v).size())
#define all(v) (v).begin(),(v).end()
#define MASK(x) (1LL << (x))
#define BIT(x,i) (((x) >> (i)) & 1)
const ll MOD = 1e9 + 7, N = 2e5 + 36, LOG = 18;
const ll INF = 1e18 + 36;
#define MAXCOLOR 6
#define WALL -2
#define BLOCK -1
#define EMPTY 0
#define PATH 1
#define U 2
#define D 3
#define L 4
#define R 5
#define BLOCKPATH 6
int rev(int x){
if(x == U)return D;
if(x == D)return U;
if(x == L)return R;
if(x == R)return L;
return 36;
}
/*
4
1 0 3
2
N
W 0 E
S
R->D->L->U
*/
void program_pulibot(){
FOR(CUR,-2,MAXCOLOR)FOR(W,-2,MAXCOLOR)FOR(S,-2,MAXCOLOR)FOR(E,-2,MAXCOLOR)FOR(N,-2,MAXCOLOR){
if(CUR == EMPTY){
if(W == WALL && N == WALL)set_instruction({CUR, W, S, E, N}, U, 'H');
else if(E == WALL && S == WALL)set_instruction({CUR, W, S, E, N}, PATH, 'H');
else if(W == R)set_instruction({CUR, W, S, E, N}, L, 'W');
else if(N == D)set_instruction({CUR, W, S, E, N}, U, 'N');
else if(E == L)set_instruction({CUR, W, S, E, N}, R, 'E');
else if(S == U)set_instruction({CUR, W, S, E, N}, D, 'S');
}
if(CUR == PATH){
if(W == WALL && N == WALL)set_instruction({CUR, W, S, E, N}, PATH, 'T');
else if(W == R)set_instruction({CUR, W, S, E, N}, PATH, 'W');
else if(S == U)set_instruction({CUR, W, S, E, N}, PATH, 'S');
else if(E == L)set_instruction({CUR, W, S, E, N}, PATH, 'E');
else if(N == D)set_instruction({CUR, W, S, E, N}, PATH, 'N');
else{
if(W == PATH)set_instruction({CUR, W, S, E, N}, BLOCKPATH, 'W');
else if(S == PATH)set_instruction({CUR, W, S, E, N}, BLOCKPATH, 'S');
else if(E == PATH)set_instruction({CUR, W, S, E, N}, BLOCKPATH, 'E');
else if(N == PATH)set_instruction({CUR, W, S, E, N}, BLOCKPATH, 'N');
}
}
if(CUR == U){
if(S == PATH && N == PATH)set_instruction({CUR, W, S, E, N}, BLOCKPATH, 'N');
else if(N == PATH)set_instruction({CUR, W, S, E, N}, PATH, 'H');
else if(E == EMPTY || E == L)set_instruction({CUR, W, S, E, N}, R, 'E');
else if(S == EMPTY || S == U)set_instruction({CUR, W, S, E, N}, D, 'S');
else if(W == EMPTY || W == R)set_instruction({CUR, W, S, E, N}, L, 'W');
else if(N == EMPTY || N == D)set_instruction({CUR, W, S, E, N}, U, 'N');
}
if(CUR == R){
if(W == PATH && E == PATH)set_instruction({CUR, W, S, E, N}, BLOCKPATH, 'E');
else if(E == PATH)set_instruction({CUR, W, S, E, N}, PATH, 'H');
else if(S == EMPTY || S == U)set_instruction({CUR, W, S, E, N}, D, 'S');
else if(W == EMPTY || W == R)set_instruction({CUR, W, S, E, N}, L, 'W');
else if(N == EMPTY || N == D)set_instruction({CUR, W, S, E, N}, U, 'N');
else if(E == EMPTY || E == L)set_instruction({CUR, W, S, E, N}, R, 'E');
}
if(CUR == D){
if(N == PATH && S == PATH)set_instruction({CUR, W, S, E, N}, BLOCKPATH, 'S');
else if(S == PATH)set_instruction({CUR, W, S, E, N}, PATH, 'H');
else if(W == EMPTY || W == R)set_instruction({CUR, W, S, E, N}, L, 'W');
else if(N == EMPTY || N == D)set_instruction({CUR, W, S, E, N}, U, 'N');
else if(E == EMPTY || E == L)set_instruction({CUR, W, S, E, N}, R, 'E');
else if(S == EMPTY || S == U)set_instruction({CUR, W, S, E, N}, D, 'S');
}
if(CUR == L){
if(E == PATH && W == PATH)set_instruction({CUR, W, S, E, N}, BLOCKPATH, 'W');
else if(W == PATH)set_instruction({CUR, W, S, E, N}, PATH, 'H');
else if(N == EMPTY || N == D)set_instruction({CUR, W, S, E, N}, U, 'N');
else if(E == EMPTY || E == L)set_instruction({CUR, W, S, E, N}, R, 'E');
else if(S == EMPTY || S == U)set_instruction({CUR, W, S, E, N}, D, 'S');
else if(W == EMPTY || W == R)set_instruction({CUR, W, S, E, N}, L, 'W');
}
}
}
| # | 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... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |