#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 4
#define WALL -2
#define BLOCK -1
#define EMPTY 0
#define PATH 1
#define BLOCKPATH 2
#define TRACK 3
#define DELBLOCKPATH 4
/*
4
1 0 3
2
N
W 0 E
S
*/
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)set_instruction({CUR,W,S,E,N}, TRACK, 'H');
if(CUR == TRACK){
if(E == WALL && S == WALL)set_instruction({CUR,W,S,E,N}, PATH, 'H');
else if(W == PATH || S == PATH || E == PATH || N == PATH)set_instruction({CUR,W,S,E,N}, PATH, 'H');
else if(W != EMPTY && S != EMPTY && N != EMPTY && E == TRACK)set_instruction({CUR,W,S,E,N}, BLOCKPATH, 'E');
else if(E != EMPTY && N != EMPTY && W != EMPTY && S == TRACK)set_instruction({CUR,W,S,E,N}, BLOCKPATH, 'S');
else if(E != EMPTY && S != EMPTY && N != EMPTY && W == TRACK)set_instruction({CUR,W,S,E,N}, BLOCKPATH, 'W');
else if(E != EMPTY && S != EMPTY && W != EMPTY && N == TRACK)set_instruction({CUR,W,S,E,N}, BLOCKPATH, 'N');
else if(E == EMPTY)set_instruction({CUR,W,S,E,N}, TRACK, 'E');
else if(S == EMPTY)set_instruction({CUR,W,S,E,N}, TRACK, 'S');
else if(W == EMPTY)set_instruction({CUR,W,S,E,N}, TRACK, 'W');
else if(N == EMPTY)set_instruction({CUR,W,S,E,N}, TRACK, 'N');
}
if(CUR == PATH){
if(N == BLOCKPATH)set_instruction({CUR,W,S,E,N}, PATH, 'N');
else if(W == BLOCKPATH)set_instruction({CUR,W,S,E,N}, PATH, 'W');
else if(S == BLOCKPATH)set_instruction({CUR,W,S,E,N}, PATH, 'S');
else if(E == BLOCKPATH)set_instruction({CUR,W,S,E,N}, PATH, 'E');
else if(W != BLOCKPATH && S != BLOCKPATH && N != BLOCKPATH && E == TRACK)set_instruction({CUR,W,S,E,N}, PATH, 'E');
else if(E != BLOCKPATH && N != BLOCKPATH && W != BLOCKPATH && S == TRACK)set_instruction({CUR,W,S,E,N}, PATH, 'S');
else if(E != BLOCKPATH && S != BLOCKPATH && N != BLOCKPATH && W == TRACK)set_instruction({CUR,W,S,E,N}, PATH, 'W');
else if(E != BLOCKPATH && S != BLOCKPATH && W != BLOCKPATH && N == TRACK)set_instruction({CUR,W,S,E,N}, PATH, 'N');
else if(N == WALL && W == WALL)set_instruction({CUR,W,S,E,N}, PATH, 'T');
}
if(CUR == BLOCKPATH){
set_instruction({CUR,W,S,E,N}, DELBLOCKPATH, 'H');
}
if(CUR == DELBLOCKPATH){
if(W != BLOCKPATH && S != BLOCKPATH && N != BLOCKPATH && (E == DELBLOCKPATH || E == PATH))set_instruction({CUR,W,S,E,N}, EMPTY, 'E');
else if(E != BLOCKPATH && N != BLOCKPATH && W != BLOCKPATH && (S == DELBLOCKPATH || S == PATH))set_instruction({CUR,W,S,E,N}, EMPTY, 'S');
else if(E != BLOCKPATH && S != BLOCKPATH && N != BLOCKPATH && (W == DELBLOCKPATH || W == PATH))set_instruction({CUR,W,S,E,N}, EMPTY, 'W');
else if(E != BLOCKPATH && S != BLOCKPATH && W != BLOCKPATH && (N == DELBLOCKPATH || N == PATH))set_instruction({CUR,W,S,E,N}, EMPTY, 'N');
else if(E == BLOCKPATH)set_instruction({CUR,W,S,E,N}, DELBLOCKPATH, 'E');
else if(S == BLOCKPATH)set_instruction({CUR,W,S,E,N}, DELBLOCKPATH, 'S');
else if(W == BLOCKPATH)set_instruction({CUR,W,S,E,N}, DELBLOCKPATH, 'W');
else if(N == BLOCKPATH)set_instruction({CUR,W,S,E,N}, DELBLOCKPATH, 'N');
}
}
}
| # | 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... |