# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1177559 | alexander707070 | Robot Contest (IOI23_robot) | C++20 | 108 ms | 6756 KiB |
#include<bits/stdc++.h>
#include "robot.h"
using namespace std;
int states;
int pos(int x){
if(x>=2 and x<=5)return x;
if(x>=6 and x<=9)return x-4;
return 0;
}
void program_pulibot(){
states=9;
for(int P=0;P<=states;P++){
for(int W=-2;W<=states;W++){
for(int S=-2;S<=states;S++){
for(int E=-2;E<=states;E++){
for(int N=-2;N<=states;N++){
if(N==-2 and W==-2 and P==0){
set_instruction({P,W,S,E,N},3,'H');
continue;
}
int period=0;
if(W>5 or S>5 or E>5 or N>5 or P>5)period=1;
if(W==1 or S==1 or E==1 or N==1 or P==1)period=2;
if(period==0){
if(P==0){
if(S==-2 and E==-2){
if(W==4)set_instruction({P,W,S,E,N},2+4,'W');
else if(N==3)set_instruction({P,W,S,E,N},5+4,'N');
else if(E==2)set_instruction({P,W,S,E,N},4+4,'E');
else if(S==5)set_instruction({P,W,S,E,N},3+4,'S');
continue;
}
if(W==4)set_instruction({P,W,S,E,N},2,'W');
else if(N==3)set_instruction({P,W,S,E,N},5,'N');
else if(E==2)set_instruction({P,W,S,E,N},4,'E');
else if(S==5)set_instruction({P,W,S,E,N},3,'S');
continue;
}
int nxt=P;
for(int i=0;i<5;i++){
nxt++;
if(nxt==6)nxt=2;
if(nxt==2 and !(W==0 or W==4))continue;
if(nxt==3 and !(S==0 or S==5))continue;
if(nxt==4 and !(E==0 or E==2))continue;
if(nxt==5 and !(N==0 or N==3))continue;
break;
}
if(nxt==2)set_instruction({P,W,S,E,N},2,'W');
if(nxt==3)set_instruction({P,W,S,E,N},3,'S');
if(nxt==4)set_instruction({P,W,S,E,N},4,'E');
if(nxt==5)set_instruction({P,W,S,E,N},5,'N');
continue;
}
if(period==1){
if(N==-2 and W==-2){
set_instruction({P,W,S,E,N},1,'H');
continue;
}
int nxt=pos(P);
for(int i=0;i<5;i++){
nxt++;
if(nxt==6)nxt=2;
if(nxt==2 and pos(W)!=4)continue;
if(nxt==3 and pos(S)!=5)continue;
if(nxt==4 and pos(E)!=2)continue;
if(nxt==5 and pos(N)!=3)continue;
break;
}
if(nxt==2)set_instruction({P,W,S,E,N},2+4,'W');
if(nxt==3)set_instruction({P,W,S,E,N},3+4,'S');
if(nxt==4)set_instruction({P,W,S,E,N},4+4,'E');
if(nxt==5)set_instruction({P,W,S,E,N},5+4,'N');
continue;
}
if(period==2){
if(E==-2 and S==-2){
set_instruction({P,W,S,E,N},1,'T');
continue;
}
if(S==9){
set_instruction({P,W,S,E,N},1,'S');
}else if(N==7){
set_instruction({P,W,S,E,N},1,'N');
}else if(E==6){
set_instruction({P,W,S,E,N},1,'E');
}else if(W==8){
set_instruction({P,W,S,E,N},1,'W');
}else{
if(S==1){
set_instruction({P,W,S,E,N},0,'S');
}else if(N==1){
set_instruction({P,W,S,E,N},0,'N');
}else if(E==1){
set_instruction({P,W,S,E,N},0,'E');
}else if(W==1){
set_instruction({P,W,S,E,N},0,'W');
}
}
}
}
}
}
}
}
}
# | 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... |