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 "robot.h"
using namespace std;
// 'W', 'S', 'E', 'N'
void f(int o, int l, int d, int r, int u)
{
vector<int> V = {o, l, d, r, u};
if(d == -2 && r == -2)
{
if(u == 3) set_instruction(V, 1, 'N');
else set_instruction(V, 1, 'W');
}
else if(u == -2 && l == -2 && (d == 1 || r == 1))
{
set_instruction(V, 1, 'T');
}
else if(l == 1 || d == 1 || r == 1 || u == 1)
{
if(l == 4) set_instruction(V, 1, 'W');
else if(d == 5) set_instruction(V, 1, 'S');
else if(r == 2) set_instruction(V, 1, 'E');
else if(u == 3) set_instruction(V, 1, 'N');
}
else
{
++o;
if(o == 1) ++o;
while(o < 6)
{
if(o == 2 && l == 0) { set_instruction(V, 2, 'W'); break; }
if(o == 3 && d == 0) { set_instruction(V, 3, 'S'); break; }
if(o == 4 && r == 0) { set_instruction(V, 4, 'E'); break; }
if(o == 5 && u == 0) { set_instruction(V, 5, 'N'); break; }
++o;
}
if(o == 6)
{
if(l == 4) set_instruction(V, 0, 'W');
else if(d == 5) set_instruction(V, 0, 'S');
else if(r == 2) set_instruction(V, 0, 'E');
else if(u == 3) set_instruction(V, 0, 'N');
}
}
}
void program_pulibot()
{
int MAXZ = 5;
for(int a = 0; a <= MAXZ; ++a)
for(int b = -2; b <= MAXZ; ++b)
for(int c = -2; c <= MAXZ; ++c)
for(int d = -2; d <= MAXZ; ++d)
for(int e = -2; e <= MAXZ; ++e)
f(a, b, c, d, e);
}
# | 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... |