1시간 27분 컷. 저번에 고민하다가 해서 시간 단축함..
뱀이 머리 이동하고 사과 있으면 꼬리 이동하므로, 뱀이 머리 이동하고 몸통이 있는 경우를 확인해야함. #include #include #include using namespace std; int n, k, l; //뱀 typedef struct { int x, y; int dir = 1; //처음은 우방향 }body; vector snake; //사과 typedef struct { int x, y; }pos; vector apple; //방향(움직임) typedef struct { int t; char dir; }dir_; queue
원문 링크 : 백준 - 뱀