# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1280757 | Luvidi | Robot Contest (IOI23_robot) | C++20 | 67 ms | 8012 KiB |
#include "robot.h"
#include <bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
#define fs first
#define sc second
pii gt(int x){
return {x>5,(x-2)%4};
}
void program_pulibot()
{
string dd="WSEN";
int mx=13;
for(int x=0;x<=mx;x++){
for(int w=-2;w<=mx;w++){
for(int s=-2;s<=mx;s++){
for(int e=-2;e<=mx;e++){
for(int n=-2;n<=mx;n++){
char d='T';
int c=x;
auto[cc,cd]=gt(x);
if(w==1||s==1||e==1||n==1){
if(w==-2&&n==-2)d='T';
else if(cd>=0)d=dd[cd];
c=1;
}else if(w==-2&&n==-2){
if(!x){
c=2;
if(!s)d='S';
else d='E';
}else{
auto[cc,cd]=gt(x);
c=x;
if(s>=0&&(!s||gt(s).fs!=cc))d='S';
else if(e>=0&&(!e||gt(e).fs!=cc))d='E';
else{
c=2+cd+4*(1-cc);
if(s>0)d='S';
else d='E';
}
}
}else if(s==-2&&e==-2){
if(w>0)cd=0;
else if(s>0)cd=1;
else if(e>0)cd=2;
else cd=3;
d=dd[cd];
c=1;
}else{
pii p;
if(x){
if(cd==0)p=gt(w);
else if(cd==1)p=gt(s);
else if(cd==2)p=gt(e);
else p=gt(n);
}else{
if(w>0)p=gt(w),cd=0;
else if(s>0)p=gt(s),cd=1;
else if(e>0)p=gt(e),cd=2;
else p=gt(n),cd=3;
}
auto[pc,pd]=p;
if(!x){
// c=2+4*pc+cd;
c=2+4*2+cd;
d=dd[cd];
}else{
c=2+4*pc+cd;
if(w>=0&&(!w||gt(w).fs!=pc&&dd[gt(w).sc]=='E'))d='W';
else if(s>=0&&(!s||gt(s).fs!=pc&&dd[gt(s).sc]=='N'))d='S';
else if(e>=0&&(!e||gt(e).fs!=pc&&dd[gt(e).sc]=='W'))d='E';
else if(n>=0&&(!n||gt(n).fs!=pc&&dd[gt(n).sc]=='S'))d='N';
else{
if(cd>=0)d=dd[cd];
}
}
}
// if(x==6&&w==5&&s==-1&&e==0&&n==-1)cout<<c<<' '<<d<<'\n';
set_instruction({x,w,s,e,n},c,d);
}
}
}
}
}
}
# | 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... |