제출 #1071183

#제출 시각아이디문제언어결과실행 시간메모리
1071183Faisal_Saqib로봇 대회 (IOI23_robot)C++17
25 / 100
343 ms10372 KiB
#include "robot.h" #include <bits/stdc++.h> using namespace std; string dir="FWSEN";; void choose(int len,vector<int>&pos,vector<int>&taken) { if(len==0) { if(taken[0]<0)return; //new eval if(taken[2]==-2 and taken[3]==-2) { set_instruction(taken,1,'T'); } else { if(taken[3]>=0 and taken[3]<taken[0]) { set_instruction(taken,taken[0],'E'); } else if(taken[2]>=0 and taken[2]<taken[0]) { set_instruction(taken,taken[0],'S'); } else if(taken[1]>=0 and taken[1]<taken[0]) { set_instruction(taken,taken[0],'W'); } else if(taken[4]>=0 and taken[4]<taken[0]){ set_instruction(taken,taken[0],'N'); } else{ if(taken[0]<19) set_instruction(taken,taken[0]+1,'H'); return; int mi=100; char lp='?'; for(int i=1;i<=4;i++) { if(taken[i]>=taken[0] and taken[i]<mi) { mi=taken[i]; lp=dir[i]; } } if((taken[0]+1)<=19 and lp!='?') { set_instruction(taken,taken[0]+1,lp); } } } return; // prev eval int mx=100,mi=-1; char tp='?',lp='?'; for(int i=1;i<taken.size();i++) { if(taken[i]<0)continue; if(taken[i]==(taken[0]-1)) lp=dir[i]; if(taken[i]>=0 and taken[i]<mx) { mx=taken[i]; tp=dir[i]; } } if(taken[2]==-2 and taken[3]==-2) { set_instruction(taken,1,'T'); } else { if(lp!='?') { set_instruction(taken,taken[0],lp); } else if(tp!='?') { if((taken[0]+1)<=19) set_instruction(taken,taken[0]+1,tp); } } return; } for(auto i:pos) { taken.push_back(i); choose(len-1,pos,taken); taken.pop_back(); } } void program_pulibot() { vector<int> states = {-1,-2}; for(int i=0;i<=19;i++) states.push_back(i); vector<int> tp; choose(5,states,tp); // set_instruction({0, -2, -1, 0, -2}, 1, 'E'); // set_instruction({0, 1, -1, 0, -2}, 1, 'E'); // set_instruction({0, 1, 0, -2, -2}, 1, 'S'); // set_instruction({0, -1, -2, -2, 1}, 1, 'T'); }

컴파일 시 표준 에러 (stderr) 메시지

robot.cpp: In function 'void choose(int, std::vector<int>&, std::vector<int>&)':
robot.cpp:56:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   56 |         for(int i=1;i<taken.size();i++)
      |                     ~^~~~~~~~~~~~~
robot.cpp:54:20: warning: unused variable 'mi' [-Wunused-variable]
   54 |         int mx=100,mi=-1;
      |                    ^~
#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...