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"
#include <iostream>
using namespace std;
enum Block_state
{
Extent,
Back,
End,
};
class Block
{
public:
std::vector<int> S;
Block_state state;
Block() {}
Block(std::vector<int> _S)
{
S = _S;
if (S[2] == -2 && S[3] == -2)
{
state = Block_state::End;
return;
}
for (int i = 1; i < 5; i++)
{
if (S[i] == 0)
{
state = Block_state::Extent;
return;
}
}
state = Block_state::Back;
}
};
class Instruction
{
public:
Block block;
int Z;
char A;
char step(int pos)
{
if (pos == 1)
return 'W';
if (pos == 2)
return 'S';
if (pos == 3)
return 'E';
if (pos == 4)
return 'N';
}
Instruction(Block _block)
{
block = _block;
if (block.state == Extent)
{
for (int i = 1; i < 5; i++)
{
if (block.S[i] == 0)
{
Z = 1;
A = step(i);
return;
}
}
}
if (block.state == Block_state::Back)
{
for (int i = 1; i < 5; i++)
{
if (block.S[i] == 1)
{
Z = 2;
A = step(i);
return;
}
}
}
if (block.state == Block_state::End)
{
Z = 1;
A = 'T';
return;
}
}
void program()
{
set_instruction(block.S, Z, A);
}
};
class Student
{
public:
int age, id;
Student(int _age)
{
age = _age;
id = 0;
}
};
void program_pulibot()
{
for (int a0 = -2; a0 <= 2; a0++)
for (int a1 = -2; a1 <= 2; a1++)
for (int a2 = -2; a2 <= 2; a2++)
for (int a3 = -2; a3 <= 2; a3++)
for (int a4 = -2; a4 <= 2; a4++)
{
vector<int> S = {a0, a1, a2, a3, a4};
Block block(S);
Instruction instruction(block);
instruction.program();
}
}
Compilation message (stderr)
robot.cpp: In member function 'char Instruction::step(int)':
robot.cpp:58:5: warning: control reaches end of non-void function [-Wreturn-type]
58 | }
| ^
# | 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... |