제출 #850031

#제출 시각아이디문제언어결과실행 시간메모리
850031rainboy로봇 대회 (IOI23_robot)C++17
100 / 100
113 ms6224 KiB
/* https://codeforces.com/blog/entry/120252 (EmeraldBlock) */ #include "robot.h" const int WALL = -2, OBSTACLE = -1, EMPTY = 0, PATH = 1, WEST = 2, SOUTH = 3, EAST = 4, NORTH = 5; void program_pulibot() { for (int x = 0; x <= 5; x++) for (int w = -2; w <= 5; w++) for (int s = -2; s <= 5; s++) for (int e = -2; e <= 5; e++) for (int n = -2; n <= 5; n++) if (x == EMPTY) { if (n == WALL && w == WALL) { if (s == EMPTY) set_instruction({ x, w, s, e, n }, SOUTH, 'S'); else if (e == EMPTY) set_instruction({ x, w, s, e, n }, EAST, 'E'); } else if (s == WALL && e == WALL) set_instruction({ x, w, s, e, n }, EAST, 'H'); else if (w == EAST) set_instruction({ x, w, s, e, n }, WEST, 'W'); else if (s == NORTH) set_instruction({ x, w, s, e, n }, SOUTH, 'S'); else if (e == WEST) set_instruction({ x, w, s, e, n }, EAST, 'E'); else if (n == SOUTH) set_instruction({ x, w, s, e, n }, NORTH, 'N'); } else if (x == WEST && (w == EAST || w == EMPTY)) { if (s == NORTH || s == EMPTY) set_instruction({ x, w, s, e, n }, SOUTH, 'S'); else if (e == WEST || e == EMPTY) set_instruction({ x, w, s, e, n }, EAST, 'E'); else if (n == SOUTH || n == EMPTY) set_instruction({ x, w, s, e, n }, NORTH, 'N'); else set_instruction({ x, w, s, e, n }, WEST, 'W'); } else if (x == SOUTH && (s == NORTH || s == EMPTY)) { if (e == WEST || e == EMPTY) set_instruction({ x, w, s, e, n }, EAST, 'E'); else if (n == SOUTH || n == EMPTY) set_instruction({ x, w, s, e, n }, NORTH, 'N'); else if (w == EAST || w == EMPTY) set_instruction({ x, w, s, e, n }, WEST, 'W'); else set_instruction({ x, w, s, e, n }, SOUTH, 'S'); } else if (x == EAST && (e == WEST || e == EMPTY)) { if (n == SOUTH || n == EMPTY) set_instruction({ x, w, s, e, n }, NORTH, 'N'); else if (w == EAST || w == EMPTY) set_instruction({ x, w, s, e, n }, WEST, 'W'); else if (s == NORTH || s == EMPTY) set_instruction({ x, w, s, e, n }, SOUTH, 'S'); else set_instruction({ x, w, s, e, n }, EAST, 'E'); } else if (x == NORTH && (n == SOUTH || n == EMPTY)) { if (w == EAST || w == EMPTY) set_instruction({ x, w, s, e, n }, WEST, 'W'); else if (s == NORTH || s == EMPTY) set_instruction({ x, w, s, e, n }, SOUTH, 'S'); else if (e == WEST || e == EMPTY) set_instruction({ x, w, s, e, n }, EAST, 'E'); else set_instruction({ x, w, s, e, n }, NORTH, 'N'); } else { if (w == EAST) set_instruction({ x, w, s, e, n }, x, 'W'); else if (s == NORTH) set_instruction({ x, w, s, e, n }, x, 'S'); else if (e == WEST) set_instruction({ x, w, s, e, n }, x, 'E'); else if (n == SOUTH) set_instruction({ x, w, s, e, n }, x, 'N'); else { char a = 'T'; if (x == WEST) a = w < 0 ? 'T' : 'W'; else if (x == SOUTH) a = s < 0 ? 'T' : 'S'; else if (x == EAST) a = e < 0 ? 'T' : 'E'; else if (x == NORTH) a = n < 0 ? 'T' : 'N'; set_instruction({ x, w, s, e, n }, n == WALL && w == WALL || w == PATH || s == PATH || e == PATH || n == PATH ? PATH : EMPTY, a); } } }

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

robot.cpp: In function 'void program_pulibot()':
robot.cpp:83:54: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   83 |         set_instruction({ x, w, s, e, n }, n == WALL && w == WALL || w == PATH || s == PATH || e == PATH || n == PATH ? PATH : EMPTY, a);
      |                                            ~~~~~~~~~~^~~~~~~~~~~~
#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...