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 <bits/stdc++.h>
using namespace std;
char dir[] = {' ', 'W', 'S', 'E', 'N'};
void set_instruction(std::vector<int> S, int Z, char A);
pair<int,char> cal(vector<int> S) {
if (S[1] == 1 || S[2] == 1 || S[3] == 1 || S[4] == 1) {
for (int i=1; i<=4; i++) {
if (S[i] >= 7 && S[i] - 6 == i) {
return {6, dir[i]};
}
}
for (int i=1; i<=4; i++) {
if (2 <= S[i] && S[i] <= 5) {
return {1, dir[i]};
}
}
return {1, 'T'};
}
if (S[0] == 6) {
for (int i=1; i<=4; i++) {
if (S[i] >= 7 && S[i] - 6 == i) {
return {6, dir[i]};
}
}
for (int i=1; i<=4; i++) {
int oth = (i - 1 + 2) % 4 + 1;
if (2 <= S[i] && S[i] <= 5 && S[i] == oth+1) {
return {oth + 6, dir[i]};
}
}
return {1, 'T'};
}
if (S[0] >= 7) {
for (int i=1; i<=4; i++) {
if (S[i] == 6) {
return {0, dir[i]};
}
}
return {1, 'T'};
}
if (S[2] == -2 && S[3] == -2) {
for (int i=1; i<=4; i++) {
if (2 <= S[i] && S[i] <= 5) {
return {1, dir[i]};
}
}
}
for (int i=1; i<=4; i++) {
if (S[i] == 0) {
return {i+1, dir[i]};
}
}
return {6, 'H'};
}
void program_pulibot()
{
int MX = 10;
for (int a=-2; a<=MX; a++) {
for (int b=-2; b<=MX; b++) {
for (int c=-2; c<=MX; c++) {
for (int d=-2; d<=MX; d++) {
for (int e=-2; e<=MX; e++) {
auto ret = cal({a, b, c, d, e});
set_instruction({a, b, c, d, e}, ret.first, ret.second);
}
}
}
}
}
}
# | 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... |