제출 #841685

#제출 시각아이디문제언어결과실행 시간메모리
841685QwertyPi로봇 대회 (IOI23_robot)C++17
컴파일 에러
0 ms0 KiB
#include "robot.h" #include <bits/stdc++.h> const int DIRECTION = -5; const int NON_PATH = -4; const int ALL = -3; const int WALL = -2; const int STONE = -1; const int EMPTY = 0; const int PATH = 1; const int VISITED = 2; const int LEFT = 3; const int DOWN = 4; const int RIGHT = 5; const int UP = 6; const int VISITED_2 = 7; const int K_MAX = 7; using namespace std; const char DIR_STAY = 'H'; const char DIR_LEFT = 'W'; const char DIR_DOWN = 'S'; const char DIR_RIGHT = 'E'; const char DIR_UP = 'N'; const char DIR_TERM = 'T'; map<vector<int>, pair<int, char>> mp; vector<int> expand(int T){ if(T == ALL){ return {WALL, STONE, EMPTY, PATH, VISITED, LEFT, DOWN, RIGHT, UP, VISITED_2}; }else if(T == NON_PATH){ vector<int> v; for(int i = -2; i <= K_MAX; i++) if(i != PATH) v.push_back(i); return v; }else if(T == DIRECTION){ return {LEFT, DOWN, RIGHT, UP}; } return {T}; } // {CELL, LEFT, DOWN, RIGHT, UP} void instruct(vector<int> A, int colour, char action){ for(auto i0 : expand(A[0])) for(auto i1 : expand(A[1])) for(auto i2 : expand(A[2])) for(auto i3 : expand(A[3])) for(auto i4 : expand(A[4])) { vector<int> a = {i0, i1, i2, i3, i4}; if(mp.count(a)) continue; mp[a] = {colour, action}; set_instruction(a, colour, action); } } void program_pulibot(){ instruct({VISITED, WALL, ALL, ALL, WALL}, PATH, DIR_TERM); instruct({PATH, WALL, ALL, ALL, WALL}, PATH, DIR_TERM); instruct({VISITED_2, RIGHT, ALL, ALL, ALL}, VISITED_2, DIR_LEFT); instruct({VISITED_2, ALL, UP, ALL, ALL}, VISITED_2, DIR_DOWN); instruct({VISITED_2, ALL, ALL, LEFT, ALL}, VISITED_2, DIR_RIGHT); instruct({VISITED_2, ALL, ALL, ALL, DOWN}, VISITED_2, DIR_UP); instruct({VISITED_2, zVISITED, ALL, ALL, ALL}, PATH, DIR_LEFT); instruct({VISITED_2, ALL, VISITED, ALL, ALL}, PATH, DIR_DOWN); instruct({VISITED_2, ALL, ALL, VISITED, ALL}, PATH, DIR_RIGHT); instruct({VISITED_2, ALL, ALL, ALL, VISITED}, PATH, DIR_UP); instruct({DIRECTION, RIGHT, ALL, ALL, ALL}, VISITED_2, DIR_LEFT); instruct({DIRECTION, ALL, UP, ALL, ALL}, VISITED_2, DIR_DOWN); instruct({DIRECTION, ALL, ALL, LEFT, ALL}, VISITED_2, DIR_RIGHT); instruct({DIRECTION, ALL, ALL, ALL, DOWN}, VISITED_2, DIR_UP); instruct({DIRECTION, VISITED_2, ALL, ALL, ALL}, EMPTY, DIR_LEFT); instruct({DIRECTION, ALL, VISITED_2, ALL, ALL}, EMPTY, DIR_DOWN); instruct({DIRECTION, ALL, ALL, VISITED_2, ALL}, EMPTY, DIR_RIGHT); instruct({DIRECTION, ALL, ALL, ALL, VISITED_2}, EMPTY, DIR_UP); instruct({VISITED_2, VISITED_2, ALL, ALL, ALL}, EMPTY, DIR_LEFT); instruct({VISITED_2, ALL, VISITED_2, ALL, ALL}, EMPTY, DIR_DOWN); instruct({VISITED_2, ALL, ALL, VISITED_2, ALL}, EMPTY, DIR_RIGHT); instruct({VISITED_2, ALL, ALL, ALL, VISITED_2}, EMPTY, DIR_UP); instruct({VISITED, VISITED, PATH, ALL, ALL}, VISITED_2, DIR_STAY); instruct({VISITED, VISITED, ALL, PATH, ALL}, VISITED_2, DIR_STAY); instruct({VISITED, VISITED, ALL, ALL, PATH}, VISITED_2, DIR_STAY); instruct({VISITED, PATH, VISITED, ALL, ALL}, VISITED_2, DIR_STAY); instruct({VISITED, ALL, VISITED, PATH, ALL}, VISITED_2, DIR_STAY); instruct({VISITED, ALL, VISITED, ALL, PATH}, VISITED_2, DIR_STAY); instruct({VISITED, PATH, ALL, VISITED, ALL}, VISITED_2, DIR_STAY); instruct({VISITED, ALL, PATH, VISITED, ALL}, VISITED_2, DIR_STAY); instruct({VISITED, ALL, ALL, VISITED, PATH}, VISITED_2, DIR_STAY); instruct({VISITED, PATH, ALL, ALL, VISITED}, VISITED_2, DIR_STAY); instruct({VISITED, ALL, PATH, ALL, VISITED}, VISITED_2, DIR_STAY); instruct({VISITED, ALL, ALL, PATH, VISITED}, VISITED_2, DIR_STAY); instruct({PATH, VISITED, ALL, ALL, ALL}, PATH, DIR_LEFT); instruct({PATH, ALL, VISITED, ALL, ALL}, PATH, DIR_DOWN); instruct({PATH, ALL, ALL, VISITED, ALL}, PATH, DIR_RIGHT); instruct({PATH, ALL, ALL, ALL, VISITED}, PATH, DIR_UP); instruct({ALL, ALL, WALL, WALL, ALL}, PATH, DIR_STAY); instruct({ALL, LEFT, ALL, ALL, ALL}, VISITED, DIR_LEFT); instruct({ALL, ALL, DOWN, ALL, ALL}, VISITED, DIR_DOWN); instruct({ALL, ALL, ALL, RIGHT, ALL}, VISITED, DIR_RIGHT); instruct({ALL, ALL, ALL, ALL, UP}, VISITED, DIR_UP); instruct({EMPTY, EMPTY, ALL, ALL, ALL}, VISITED, DIR_LEFT); instruct({EMPTY, ALL, EMPTY, ALL, ALL}, VISITED, DIR_DOWN); instruct({EMPTY, ALL, ALL, EMPTY, ALL}, VISITED, DIR_RIGHT); instruct({EMPTY, ALL, ALL, ALL, EMPTY}, VISITED, DIR_UP); instruct({VISITED, EMPTY, ALL, ALL, ALL}, VISITED, DIR_LEFT); instruct({VISITED, ALL, EMPTY, ALL, ALL}, VISITED, DIR_DOWN); instruct({VISITED, ALL, ALL, EMPTY, ALL}, VISITED, DIR_RIGHT); instruct({VISITED, ALL, ALL, ALL, EMPTY}, VISITED, DIR_UP); instruct({ALL, VISITED, ALL, ALL, ALL}, LEFT, DIR_LEFT); instruct({ALL, ALL, VISITED, ALL, ALL}, DOWN, DIR_DOWN); instruct({ALL, ALL, ALL, VISITED, ALL}, RIGHT, DIR_RIGHT); instruct({ALL, ALL, ALL, ALL, VISITED}, UP, DIR_UP); }

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

robot.cpp: In function 'void program_pulibot()':
robot.cpp:66:26: error: 'zVISITED' was not declared in this scope; did you mean 'VISITED'?
   66 |     instruct({VISITED_2, zVISITED, ALL, ALL, ALL}, PATH, DIR_LEFT);
      |                          ^~~~~~~~
      |                          VISITED
robot.cpp:66:66: error: could not convert '{VISITED_2, <expression error>, ALL, ALL, ALL}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
   66 |     instruct({VISITED_2, zVISITED, ALL, ALL, ALL}, PATH, DIR_LEFT);
      |                                                                  ^
      |                                                                  |
      |                                                                  <brace-enclosed initializer list>