이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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();
}
}
컴파일 시 표준 에러 (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... |