# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
885900 | irmuun | Robot Contest (IOI23_robot) | C++17 | 127 ms | 6484 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;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()
//west-zuun
//south-dood
//east-baruun
//north-deed
string s="TWSEN";
vector<int>u[6];
vector<int>t={-1,4,5,2,3};
void program_pulibot(){
u[0]={1,2,3,4};
u[1]={2,3,4,1};
u[2]={3,4,1,2};
u[3]={4,1,2,3};
u[4]={1,2,3,4};
vector<int>v(5);
v[0]=0;
for(v[0]=0;v[0]<=6;v[0]++){//cur
for(v[1]=-2;v[1]<=6;v[1]++){//west
for(v[2]=-2;v[2]<=6;v[2]++){//south
for(v[3]=-2;v[3]<=6;v[3]++){//east
for(v[4]=-2;v[4]<=6;v[4]++){//north
//check backward
bool back=false,forw=false;
for(int i=1;i<5;i++){
if(v[i]==6){
back=true;
}
if(v[i]==1){
forw=true;
}
}
if(back==true&&v[1]==-2&&v[4]==-2){
forw=true;
}
if(v[2]==-2&&v[3]==-2&&(v[1]==1||v[4]==1)){
set_instruction(v,1,s[0]);
continue;
}
if(forw){
for(int i=1;i<5;i++){
if(v[i]==6){
set_instruction(v,1,s[i]);
break;
}
}
continue;
}
if(v[2]==-2&&v[3]==-2&&(v[1]==4||v[4]==3)){
back=true;
}
if(back){
for(int i=1;i<5;i++){
if(v[i]>0&&v[i]<6){
set_instruction(v,6,s[i]);
break;
}
}
continue;
}
int from=v[0];
if(v[0]==0){
for(int i=1;i<=4;i++){
if(v[i]==t[i]){
from=i;
break;
}
}
}
else{
if(from>0){
from--;
}
}
int nxt=-1;
for(auto x:u[from]){
if(v[x]>=0){
nxt=x;
break;
}
}
if(nxt==-1) continue;
if(v[nxt]==0){
set_instruction(v,nxt+1,s[nxt]);
}
else{
set_instruction(v,0,s[nxt]);
}
}
}
}
}
}
}
# | 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... |