제출 #1026105

#제출 시각아이디문제언어결과실행 시간메모리
1026105Andrey로봇 대회 (IOI23_robot)C++17
85 / 100
150 ms7248 KiB
#include "robot.h" #include<bits/stdc++.h> using namespace std; bool check(int a, int x) { if(a >= 2 && a <= 5 && (a-x+1002)%4 == 0) { return false; } return true; } void program_pulibot() { /*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');*/ char dir[6] = {'z','T','W','S','E','N'}; for(int c = -2; c < 11; c++) { for(int w = -2; w < 11; w++) { for(int s = -2; s < 11; s++) { for(int e = -2; e < 11; e++) { for(int n = -2; n < 11; n++) { if(c < 0) { continue; } if(c == 0) { if(n == -2 && w == -2) { set_instruction({c,w,s,e,n},2,'H'); } else { if(w > 5) { set_instruction({c,w,s,e,n},2,'W'); } else if(s > 5) { set_instruction({c,w,s,e,n},3,'S'); } else if(e > 5) { set_instruction({c,w,s,e,n},4,'E'); } else if(n > 5) { set_instruction({c,w,s,e,n},5,'N'); } } continue; } if((w == 1 || s == 1 || e == 1 || n == 1 || (s == -2 && e == -2)) && (!(w == 10 || s == 10 || e == 10 || n == 10))) { if(c != 10) { set_instruction({c,w,s,e,n},10,'H'); continue; } if(c == 10 && check(w,2) && check(s,3) && check(e,4) && check(n,5)) { if(w > 5) { set_instruction({c,w,s,e,n},1,'W'); } else if(s > 5) { set_instruction({c,w,s,e,n},1,'S'); } else if(e > 5) { set_instruction({c,w,s,e,n},1,'E'); } else if(n > 5) { set_instruction({c,w,s,e,n},1,'N'); } else { set_instruction({c,w,s,e,n},1,'T'); } } else { int p; if(!check(w,2)) { p = 2; } else if(!check(s,3)) { p = 3; } else if(!check(e,4)) { p = 4; } else if(!check(n,5)) { p = 5; } set_instruction({c,w,s,e,n},10,dir[p]); } continue; } if(c == 10) { int p; if(check(w,2) && check(s,3) && check(e,4) && check(n,5)) { if(w == 10) { p = 2; } else if(s == 10) { p = 3; } else if(e == 10) { p = 4; } else { p = 5; } set_instruction({c,w,s,e,n},0,dir[p]); } else { if(!check(w,2)) { p = 2; } else if(!check(s,3)) { p = 3; } else if(!check(e,4)) { p = 4; } else if(!check(n,5)) { p = 5; } set_instruction({c,w,s,e,n},10,dir[p]); } continue; } if(w == 10 || s == 10 || e == 10 || n == 10) { set_instruction({c,w,s,e,n},10,'H'); continue; } int p = c; char a; if(p > 5) { p-=4; } p++; if(p == 6) { p-=4; } int x; if(p == 2) { x = w; } else if(p == 3) { x = s; } else if(p == 4) { x = e; } else { x = n; } if(x < 0) { set_instruction({c,w,s,e,n},p+4,'H'); } else { if((x-p+1002)%4 == 0 || x == 0) { if(x > 5) { set_instruction({c,w,s,e,n},p,dir[p]); } else { set_instruction({c,w,s,e,n},p+4,dir[p]); } } else { set_instruction({c,w,s,e,n},p+4,'H'); } } } } } } } }

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

robot.cpp: In function 'void program_pulibot()':
robot.cpp:126:30: warning: unused variable 'a' [-Wunused-variable]
  126 |                         char a;
      |                              ^
robot.cpp:117:69: warning: 'p' may be used uninitialized in this function [-Wmaybe-uninitialized]
  117 |                                 set_instruction({c,w,s,e,n},10,dir[p]);
      |                                                                ~~~~~^
robot.cpp:83:69: warning: 'p' may be used uninitialized in this function [-Wmaybe-uninitialized]
   83 |                                 set_instruction({c,w,s,e,n},10,dir[p]);
      |                                                                ~~~~~^
#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...