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;
map <vector<int> ,char> mp;
vector< vector<int> > all;
void program_pulibot()
{
//注 s[0]原地,s[1] 西方,s[2]南方,s[3]東方,s[4]北方
//第一步,set_instruction 判斷終止程式,當右方、下方都是-2時
for(int i=-2;i<=1;i++)
{
vector<int> temp;
for(int cc=1;cc<=5;cc++)temp.push_back(-2);
for(int j=-2;j<=1;j++)
{
for(int k=-2;k<=1;k++)
{
temp[0] = i;
temp[1] = j;
temp[4] = k;
char c = 'T';
set_instruction(temp,1,c);
/*if(mp[temp] == 1)for(auto it : temp)cout<<it<<" ";
cout<<c<<endl;
*/
mp[temp] = c;
}
}
}
//第二步,向右;當且僅當右方是0時
for(int i=-2;i<=1;i++)
{
vector<int> temp;
for(int cc=1;cc<=5;cc++)temp.push_back(0);
for(int j=-2;j<=1;j++)
{
for(int k=-2;k<=1;k++)
{
for(int p=-2;p<=1;p++)
{
temp[0] = i;
temp[1] = j;
temp[2] = k;
temp[3] = 0;
temp[4] = p;
char c = 'E';
set_instruction(temp,1,c);
/*if(mp[temp] == 1)for(auto it : temp)cout<<it<<" ";
cout<<c<<endl;
*/
mp[temp] = c;
}
}
}
}
//第三步,向上,當且僅當右方是障礙物(-1)且上方為0
for(int i=-2;i<=1;i++)
{
vector<int> temp;
for(int cc=1;cc<=5;cc++)temp.push_back(-2);
for(int j=-2;j<=1;j++)
{
for(int k=-2;k<=1;k++)
{
temp[0] = i;
temp[1] = j;
temp[2] = k;
temp[3] = -1;
temp[4] = 0;
char c = 'N';
if(temp[2] == 0 && temp[3] == -1)continue;
set_instruction(temp,1,c);
/*if(mp[temp] == 1)for(auto it : temp)cout<<it<<" ";
cout<<c<<endl;
*/
mp[temp] = c;
}
}
}
//第四步,向下,當且僅當右方是障礙物且下方為0;
for(int i=-2;i<=1;i++)
{
vector<int> temp;
for(int cc=1;cc<=5;cc++)temp.push_back(-2);
for(int j=-2;j<=1;j++)
{
for(int k=-2;k<=1;k++)
{
temp[0] = i;
temp[1] = j;
temp[2] = 0;
temp[3] = -1;
temp[4] = k;
char c = 'S';
if(temp[4] == 0 && temp[3] == -1)continue;
set_instruction(temp,1,c);
/*if(mp[temp] == 1)for(auto it : temp)cout<<it<<" ";
cout<<c<<endl;
*/
mp[temp] = c;
}
}
}
for(int i=-2;i<=1;i++)
{
vector<int> temp;
for(int cc=1;cc<=5;cc++)temp.push_back(-2);
for(int j=-2;j<=1;j++)
{
for(int k=-2;k<=1;k++)
{
temp[0] = i;
temp[1] = j;
temp[2] = 0;
temp[3] = -2;
temp[4] = k;
char c = 'S';
if(temp[4] == 0 && temp[3] == -1)continue;
set_instruction(temp,1,c);
/*if(mp[temp] == 1)for(auto it : temp)cout<<it<<" ";
cout<<c<<endl;
*/
mp[temp] = c;
}
}
}
/*vector<int> v = {0,-2,-1,0,-2};
cout<<mp[v]<<endl;
vector<int> v2 = {0,1,-1,0,-2};
cout<<mp[v2]<<endl;
vector<int> v3 = {0,1,0,-2,-2};
cout<<mp[v3]<<endl;
vector<int> v4 = {0,-1,-2,-2,1};
cout<<mp[v4]<<endl;*/
}
# | 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... |