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