Submission #1041927

#TimeUsernameProblemLanguageResultExecution timeMemory
1041927AndreyRobot Contest (IOI23_robot)C++17
100 / 100
92 ms6228 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 true; } return false; } bool dude(int a) { if(a >= 2 && a <= 5) { return false; } return true; } void program_pulibot() { char dir[6] = {'z','T','W','S','E','N'}; for(int c = 0; c <= 6; c++) { for(int w = -2; w <= 6; w++) { for(int s = -2; s <= 6; s++) { for(int e = -2; e <= 6; e++) { for(int n = -2; n <= 6; n++) { if(c == 0) { if(s == -2 && e == -2) { set_instruction({c,w,s,e,n},6,'H'); continue; } if(w == -2 && n == -2) { set_instruction({c,w,s,e,n},2,'H'); } else if(check(w,2)) { set_instruction({c,w,s,e,n},2,'W'); } else if(check(s,3)) { set_instruction({c,w,s,e,n},3,'S'); } else if(check(e,4)) { set_instruction({c,w,s,e,n},4,'E'); } else if(check(n,5)) { set_instruction({c,w,s,e,n},5,'N'); } continue; } if(c == 6) { if(check(w,2)) { set_instruction({c,w,s,e,n},6,'W'); } else if(check(s,3)) { set_instruction({c,w,s,e,n},6,'S'); } else if(check(e,4)) { set_instruction({c,w,s,e,n},6,'E'); } else if(check(n,5)) { set_instruction({c,w,s,e,n},6,'N'); } else { if(w == 6) { set_instruction({c,w,s,e,n},2,'W'); } else if(s == 6) { set_instruction({c,w,s,e,n},3,'S'); } else if(e == 6) { set_instruction({c,w,s,e,n},4,'E'); } else if(n == 6) { set_instruction({c,w,s,e,n},5,'N'); } else { set_instruction({c,w,s,e,n},1,'T'); } } continue; } if(w == 6 && c != 2) { set_instruction({c,w,s,e,n},2,dir[c]); continue; } else if(s == 6 && c != 3) { set_instruction({c,w,s,e,n},3,dir[c]); continue; } else if(e == 6 && c != 4) { set_instruction({c,w,s,e,n},4,dir[c]); continue; } else if(n == 6 && c != 5) { set_instruction({c,w,s,e,n},5,dir[c]); continue; } int x = 1; if(w == 6) { x = 2; } if(s == 6) { x = 3; } if(e == 6) { x = 4; } if(n == 6) { x = 5; } if((check(w,2) || check(s,3) || check(e,4) || check(n,5)) && x != 1) { set_instruction({c,w,s,e,n},6,'H'); continue; } if(w == 1 || s == 1 || e == 1 || n == 1 || ((n == -2 && w == -2) && x != 1) || (s == -2 && e == -2)) { if(!dude(w)) { set_instruction({c,w,s,e,n},2,dir[c]); } else if(!dude(s)) { set_instruction({c,w,s,e,n},3,dir[c]); } else if(!dude(e)) { set_instruction({c,w,s,e,n},4,dir[c]); } else if(!dude(n)) { set_instruction({c,w,s,e,n},5,dir[c]); } else { set_instruction({c,w,s,e,n},1,dir[x]); } continue; } if(x != 1) { set_instruction({c,w,s,e,n},0,dir[x]); continue; } int p = c+1,z; if(p == 6) { p-=4; } if(p == 2) { z = w; } else if(p == 3) { z = s; } else if(p == 4) { z = e; } else if(p == 5) { z = n; } if(z == 0 || check(z,p)) { set_instruction({c,w,s,e,n},p,dir[p]); } else { set_instruction({c,w,s,e,n},p,'H'); } } } } } } }
#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...