실행 실패 (제출 코드 컴파일 에러)
Main.cpp:1:7: error: expected nested-name-specifier before ‘System’ 1 | using System; | ^~~~~~ Main.cpp:2:7: error: expected nested-name-specifier before ‘System’ 2 | using System.Linq; | ^~~~~~ Main.cpp:9:15: error: expected ‘:’ before ‘char’ 9 | public char command_rot; | ^~~~~ | : Main.cpp:10:15: error: expected ‘:’ before ‘int’ 10 | public int sec; | ^~~~ | : Main.cpp:12:15: error: expected ‘:’ before ‘Sequence’ 12 | public Sequence(char command, int sec) | ^~~~~~~~~ | : Main.cpp:17:6: error: expected ‘;’ after class definition 17 | } | ^ | ; Main.cpp:27:12: error: expected unqualified-id before ‘[’ token 27 | int[] right = new int[2] { 0, 1 }; | ^ Main.cpp:28:12: error: expected unqualified-id before ‘[’ token 28 | int[] left = new int[2] { 0, -1 }; | ^ Main.cpp:29:12: error: expected unqualified-id before ‘[’ token 29 | int[] down = new int[2] { 1, 0 }; | ^ Main.cpp:30:12: error: expected unqualified-id before ‘[’ token 30 | int[] up = new int[2] { -1, 0 }; | ^ Main.cpp:32:15: error: expected ‘:’ before ‘int’ 32 | public int[] GetArrowCommand() | ^~~~ | : Main.cpp:32:19: error: expected unqualified-id before ‘[’ token 32 | public int[] GetArrowCommand() | ^ Main.cpp:51:15: error: expected ‘:’ before ‘void’ 51 | public void SetRot(char command) | ^~~~~ | : Main.cpp:72:6: error: expected ‘;’ after class definition 72 | } | ^ | ; Main.cpp:76:15: error: expected ‘:’ before ‘int’ 76 | public int x; | ^~~~ | : Main.cpp:77:15: error: expected ‘:’ before ‘int’ 77 | public int y; | ^~~~ | : Main.cpp:78:6: error: expected ‘;’ after class definition 78 | } | ^ | ; Main.cpp:82:9: error: ‘List’ does not name a type 82 | List<Body> bodyList = new List<Body>(); | ^~~~ Main.cpp:84:15: error: expected ‘:’ before ‘Snake’ 84 | public Snake() | ^~~~~~ | : Main.cpp:94:15: error: expected ‘:’ before ‘void’ 94 | public void SetPosition(int[] arrowCommand) | ^~~~~ | : Main.cpp:94:39: error: expected ‘,’ or ‘...’ before ‘arrowCommand’ 94 | public void SetPosition(int[] arrowCommand) | ^~~~~~~~~~~~ Main.cpp:128:15: error: expected ‘:’ before ‘void’ 128 | public void AddBody(int[] arrowCommand) | ^~~~~ | : Main.cpp:128:35: error: expected ‘,’ or ‘...’ before ‘arrowCommand’ 128 | public void AddBody(int[] arrowCommand) | ^~~~~~~~~~~~ Main.cpp:142:15: error: expected ‘:’ before ‘Body’ 142 | public Body GetHead() | ^~~~~ | : Main.cpp:147:15: error: expected ‘:’ before ‘Body’ 147 | public Body GetTail() | ^~~~~ | : Main.cpp:152:15: error: expected ‘:’ before ‘bool’ 152 | public bool CheckEatApple(int x, int y) | ^~~~~ | : Main.cpp:163:6: error: expected ‘;’ after class definition 163 | } | ^ | ; Main.cpp:167:15: error: expected unqualified-id before ‘[’ token 167 | static int[,] map; | ^ Main.cpp:170:12: error: ‘List’ does not name a type 170 | static List<Sequence> sequenceList = new List<Sequence>(); | ^~~~ Main.cpp:171:36: error: default member initializer for ‘Program::Arrow::rot’ required before the end of its enclosing class 171 | static Arrow arrow = new Arrow(); | ^ Main.cpp:25:17: note: defined here 25 | int rot = 90; | ^~~~~ Main.cpp:171:18: error: ‘constexpr’ needed for in-class initialization of static data member ‘Program::Arrow Program::arrow’ of non-integral type [-fpermissive] 171 | static Arrow arrow = new Arrow(); | ^~~~~ Main.cpp:171:36: error: non-constant in-class initialization invalid for non-inline static member ‘Program::arrow’ 171 | static Arrow arrow = new Arrow(); | ^ Main.cpp:171:36: note: (an out of class initialization is required) Main.cpp:280:48: error: expected ‘,’ or ‘...’ before ‘arrowCommand’ 280 | static bool CheckEatApple(Body head, int[] arrowCommand) | ^~~~~~~~~~~~ Main.cpp:296:48: error: expected ‘,’ or ‘...’ before ‘arrowCommand’ 296 | static bool CheckGameOver(Body head, int[] arrowCommand) | ^~~~~~~~~~~~ Main.cpp:317:2: error: expected ‘;’ after class definition 317 | } | ^ | ; Main.cpp: In constructor ‘Program::Sequence::Sequence(char, int)’: Main.cpp:14:18: error: request for member ‘command_rot’ in ‘(Program::Sequence*)this’, which is of pointer type ‘Program::Sequence*’ (maybe you meant to use ‘->’ ?) 14 | this.command_rot = command; | ^~~~~~~~~~~ Main.cpp:15:18: error: request for member ‘sec’ in ‘(Program::Sequence*)this’, which is of pointer type ‘Program::Sequence*’ (maybe you meant to use ‘->’ ?) 15 | this.sec = sec; | ^~~ Main.cpp: In constructor ‘Program::Snake::Snake()’: Main.cpp:86:25: error: conversion from ‘Program::Body*’ to non-scalar type ‘Program::Body’ requested 86 | Body body = new Body(); | ^~~~~~~~~~ Main.cpp:91:13: error: ‘bodyList’ was not declared in this scope 91 | bodyList.Add(body); | ^~~~~~~~ Main.cpp: In member function ‘void Program::Snake::SetPosition(int*)’: Main.cpp:96:27: error: ‘bodyList’ was not declared in this scope 96 | int bodyNum = bodyList.Count; | ^~~~~~~~ Main.cpp:102:13: error: ‘map’ was not declared in this scope 102 | map[tail.y, tail.x] = 0; | ^~~ Main.cpp:102:23: warning: top-level comma expression in array subscript is deprecated [-Wcomma-subscript] 102 | map[tail.y, tail.x] = 0; | ^ Main.cpp:102:22: warning: left operand of comma operator has no effect [-Wunused-value] 102 | map[tail.y, tail.x] = 0; | ~~~~~^ Main.cpp:111:35: error: ‘arrowCommand’ was not declared in this scope 111 | bodyData.x += arrowCommand[1]; | ^~~~~~~~~~~~ Main.cpp:114:35: warning: top-level comma expression in array subscript is deprecated [-Wcomma-subscript] 114 | map[bodyData.y, bodyData.x] = 1; | ^ Main.cpp:114:34: warning: left operand of comma operator has no effect [-Wunused-value] 114 | map[bodyData.y, bodyData.x] = 1; | ~~~~~~~~~^ Main.cpp: In member function ‘void Program::Snake::AddBody(int*)’: Main.cpp:130:28: error: conversion from ‘Program::Body*’ to non-scalar type ‘Program::Body’ requested 130 | Body newBody = new Body(); | ^~~~~~~~~~ Main.cpp:134:34: error: ‘arrowCommand’ was not declared in this scope 134 | newBody.x = head.x + arrowCommand[1]; | ^~~~~~~~~~~~ Main.cpp:137:13: error: ‘map’ was not declared in this scope 137 | map[newBody.y, newBody.x] = 1; | ^~~ Main.cpp:137:26: warning: top-level comma expression in array subscript is deprecated [-Wcomma-subscript] 137 | map[newBody.y, newBody.x] = 1; | ^ Main.cpp:137:25: warning: left operand of comma operator has no effect [-Wunused-value] 137 | map[newBody.y, newBody.x] = 1; | ~~~~~~~~^ Main.cpp:139:13: error: ‘bodyList’ was not declared in this scope 139 | bodyList.Add(newBody); | ^~~~~~~~ Main.cpp: In member function ‘Program::Body Program::Snake::GetHead()’: Main.cpp:144:20: error: ‘bodyList’ was not declared in this scope 144 | return bodyList[bodyList.Count - 1]; | ^~~~~~~~ Main.cpp: In member function ‘Program::Body Program::Snake::GetTail()’: Main.cpp:149:20: error: ‘bodyList’ was not declared in this scope 149 | return bodyList[0]; | ^~~~~~~~ Main.cpp: In member function ‘bool Program::Snake::CheckEatApple(int, int)’: Main.cpp:154:16: error: ‘map’ was not declared in this scope 154 | if(map[y,x] == 2) | ^~~ Main.cpp:154:21: warning: top-level comma expression in array subscript is deprecated [-Wcomma-subscript] 154 | if(map[y,x] == 2) | ^ Main.cpp:154:20: warning: left operand of comma operator has no effect [-Wunused-value] 154 | if(map[y,x] == 2) | ^ Main.cpp: In static member function ‘static void Program::Main()’: Main.cpp:176:15: error: expected nested-name-specifier before ‘StreamWriter’ 176 | using StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())); | ^~~~~~~~~~~~ Main.cpp:178:15: error: expected nested-name-specifier before ‘StreamReader’ 178 | using StreamReader reader = new StreamReader(new BufferedStream(Console.OpenStandardInput())); | ^~~~~~~~~~~~ Main.cpp:180:14: error: expected primary-expression before ‘int’ 180 | N = int.Parse(reader.ReadLine()); | ^~~ Main.cpp:181:14: error: expected primary-expression before ‘int’ 181 | K = int.Parse(reader.ReadLine()); | ^~~ Main.cpp:183:9: error: ‘map’ was not declared in this scope 183 | map = new int[N + 1, N + 1]; | ^~~ Main.cpp:183:25: warning: left operand of comma operator has no effect [-Wunused-value] 183 | map = new int[N + 1, N + 1]; | ~~^~~ Main.cpp:188:13: error: ‘string’ was not declared in this scope 188 | string[] command_X_Y = reader.ReadLine().Split(); | ^~~~~~ Main.cpp:188:20: error: expected primary-expression before ‘]’ token 188 | string[] command_X_Y = reader.ReadLine().Split(); | ^ Main.cpp:190:21: error: expected primary-expression before ‘int’ 190 | int x = int.Parse(command_X_Y[0]); //행 | ^~~ Main.cpp:191:21: error: expected primary-expression before ‘int’ 191 | int y = int.Parse(command_X_Y[1]); //열 | ^~~ Main.cpp:193:18: warning: top-level comma expression in array subscript is deprecated [-Wcomma-subscript] 193 | map[y, x] = 2; | ^ Main.cpp:193:17: warning: left operand of comma operator has no effect [-Wunused-value] 193 | map[y, x] = 2; | ^ Main.cpp:196:17: error: expected primary-expression before ‘int’ 196 | int L = int.Parse(reader.ReadLine()); | ^~~ Main.cpp:200:13: error: ‘string’ was not declared in this scope 200 | string[] command_X_C = reader.ReadLine().Split(); | ^~~~~~ Main.cpp:200:20: error: expected primary-expression before ‘]’ token 200 | string[] command_X_C = reader.ReadLine().Split(); | ^ Main.cpp:202:23: error: expected primary-expression before ‘int’ 202 | int sec = int.Parse(command_X_C[0]); | ^~~ Main.cpp:203:28: error: expected primary-expression before ‘char’ 203 | char command = char.Parse(command_X_C[1]); | ^~~~ Main.cpp:205:33: error: conversion from ‘Program::Sequence*’ to non-scalar type ‘Program::Sequence’ requested 205 | Sequence sequence = new Sequence(command, sec); | ^~~~~~~~~~~~~~~~~~~~~~~~~~ Main.cpp:206:13: error: ‘sequenceList’ was not declared in this scope; did you mean ‘sequence’? 206 | sequenceList.Add(sequence); | ^~~~~~~~~~~~ | sequence Main.cpp:209:51: error: expected primary-expression before ‘int’ 209 | Sequence sequence_end = new Sequence('e', int.MaxValue); | ^~~ Main.cpp:210:9: error: ‘sequenceList’ was not declared in this scope; did you mean ‘sequence_end’? 210 | sequenceList.Add(sequence_end); | ^~~~~~~~~~~~ | sequence_end Main.cpp:214:9: error: ‘writer’ was not declared in this scope 214 | writer.WriteLine(sec_count.ToString()); | ^~~~~~ Main.cpp:214:36: error: request for member ‘ToString’ in ‘Program::sec_count’, which is of non-class type ‘int’ 214 | writer.WriteLine(sec_count.ToString()); | ^~~~~~~~ Main.cpp: In static member function ‘static void Program::GameStart()’: Main.cpp:224:23: error: conversion from ‘Program::Snake*’ to non-scalar type ‘Program::Snake’ requested 224 | Snake snake = new Snake(); | ^~~~~~~~~~~ Main.cpp:228:22: error: ‘null’ was not declared in this scope 228 | Sequence s = null; | ^~~~ Main.cpp:234:17: error: ‘sequenceList’ was not declared in this scope; did you mean ‘Sequence’? 234 | s = sequenceList[seq_count]; | ^~~~~~~~~~~~ | Sequence Main.cpp:240:16: error: structured binding declaration cannot have type ‘int’ 240 | int[] arrowCommand = arrow.GetArrowCommand(); | ^~ Main.cpp:240:16: note: type must be cv-qualified ‘auto’ or reference to cv-qualified ‘auto’ Main.cpp:240:16: error: empty structured binding declaration Main.cpp:240:19: error: expected initializer before ‘arrowCommand’ 240 | int[] arrowCommand = arrow.GetArrowCommand(); | ^~~~~~~~~~~~ Main.cpp:248:41: error: ‘arrowCommand’ was not declared in this scope 248 | if (CheckGameOver(head, arrowCommand) == false) | ^~~~~~~~~~~~ Main.cpp:240:16: warning: unused structured binding declaration [-Wunused-variable] 240 | int[] arrowCommand = arrow.GetArrowCommand(); | ^~ Main.cpp: In static member function ‘static bool Program::CheckEatApple(Program::Body, int*)’: Main.cpp:282:30: error: ‘arrowCommand’ was not declared in this scope 282 | int headY = head.x + arrowCommand[1]; | ^~~~~~~~~~~~ Main.cpp:285:12: error: ‘map’ was not declared in this scope 285 | if(map[headY,headX] == 2) | ^~~ Main.cpp:285:21: warning: top-level comma expression in array subscript is deprecated [-Wcomma-subscript] 285 | if(map[headY,headX] == 2) | ^ Main.cpp:285:16: warning: left operand of comma operator has no effect [-Wunused-value] 285 | if(map[headY,headX] == 2) | ^~~~~ Main.cpp: In static member function ‘static bool Program::CheckGameOver(Program::Body, int*)’: Main.cpp:298:30: error: ‘arrowCommand’ was not declared in this scope 298 | int headX = head.x + arrowCommand[1]; | ^~~~~~~~~~~~ Main.cpp:309:13: error: ‘map’ was not declared in this scope 309 | if (map[headY, headX] == 1) | ^~~ Main.cpp:309:22: warning: top-level comma expression in array subscript is deprecated [-Wcomma-subscript] 309 | if (map[headY, headX] == 1) | ^ Main.cpp:309:17: warning: left operand of comma operator has no effect [-Wunused-value] 309 | if (map[headY, headX] == 1) | ^~~~~
정답 개수:
-
틀린 개수:
-
실행 실패 개수:
-
반례를 발견하지 못했습니다.