# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1067599 | Ahmed57 | 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 "bits/stdc++.h"
#include "robot.h"
using namespace std;
//2 WEST
//3 SOUTH
//4 EAST
//5 NORTH
enum Id {
Bound = -2,
Block,
Empty,
Path,
West,
South,
East,
North
};
char arr[] = {'W','S','E','N'};
void program_pulibot(){
for(int c = 0;c<=5;c++){
for(int w = -2;w<=5;w++){
for(int s = -2;s<=5;s++){
for(int e = -2;e<=5;e++){
for(int n = -2;n<=5;n++){
vector<int> lol = {w,s,e,n};
if(c==0){
if(n==Bound&&w==Bound){
if(s==Bound){
set_interaction({c,w,s,e,n},East,'E');
}else{
set_interaction({c,w,s,e,n},South,'S');
}
}else if(s==Bound&&e==Bound){
set_interaction({c,w,s,e,n},East,'E');
}else{
for(int i = 0;i<4;i++){
if(lol[i]-2==(i+2)%4){
set_interaction({c,w,s,e,n},West+i,arr[i]);
break;
}
}
}
}else{
if(lol[c-2]-2==(c+2)%4){
for(int e = 1;e<=4;e++){
int i = (c-2+e)%4;
if(lol[i]-2==(i+2)%4){
set_interaction({c,w,s,e,n},West+i,arr[i]);
break;
}
}
}else{
bool path = 0;
bool done = 0;
for(int e = 1;e<=4;e++){
int i = (c-2+e)%4;
if(lol[i]==1){
path = 1;
}
if(lol[i]-2==(i+2)%4){
set_interaction({c,w,s,e,n},c,arr[i]);
done = 1;
}
}
if(done)continue;
set_anteraction({c,w,s,e,n},(path||(w==Bound&&n==Bound))?Path:Empty,(e==Bound||s==Bound)?'T':arr[(c+1)%4]);
}
}
}
}
}
}
}
}