# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1082271 | mickey080929 | Robot Contest (IOI23_robot) | C++17 | 0 ms | 0 KiB |
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] == 6) {
return {7, dir[i]};
}
}
for (int i=1; i<=4; i++) {
if (S[i] > 1) {
return {1, dir[i]};
}
}
return {1, 'T'};
}
if (S[0] == 7) {
for (int i=1; i<=4; i++) {
if (S[i] == 6) {
return {7, dir[i]};
}
}
for (int i=1; i<=4; i++) {
if (2<=S[i] && S[i]<=5 && (S[i] - 1 - i + 4) % 4 == 2) {
return {6, dir[i]};
}
}
return {1, 'T'};
}
if (S[0] == 6) {
for (int i=1; i<=4; i++) {
if (S[i] == 7) {
return {0, dir[i]};
}
}
return {1, 'T'};
}
for (int i=1; i<=4; i++) {
if (S[i] == 0) {
return {i+1, dir[i]};
}
}
if (S[2] == -2 && S[3] == -2) {
for (int i=1; i<=4; i++) {
if (S[i] > 1 && S[i] != 6) {
return {1, dir[i]};
}
}
}
return {7, 'H'};
}