제출 #1025602

#제출 시각아이디문제언어결과실행 시간메모리
1025602LIF로봇 대회 (IOI23_robot)C++17
16 / 100
89 ms5764 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...