제출 #1307739

#제출 시각아이디문제언어결과실행 시간메모리
1307739the_commando_xMini tetris (IOI16_tetris)C++17
컴파일 에러
0 ms0 KiB

#include "tetris.h"

void init(int n)
{
}

int state;
int position;
int rotation;

/*
State Config
0	(0,0,0)
1	(1,0,0)
2	(1,1,0)
3	(1,1,1)
4	(2,1,1)
5	(2,2,1)
*/
void new_figure(int figure_type)
{
	switch (figure_type)
	{
	case 1:
		if (state == 0)
		{
			position = 0, rotation = 0;
			state = 0;
		}
		// else
		// {
		// 	position = 0, rotation = 1;
		// 	if (state == 1)
		// 		state = 2;
		// 	else if (state == 2)
		// 		state = 3;
		// 	else if (state == 3)
		// 		state = 4;
		// 	else if (state == 4)
		// 		state = 5;
		// }
		break;
	case 2:
		if (state == 2 || state == 4)
		{
			position = 1, rotation = 0;
			state = 0;
		}
		else
		{
			position = 0, rotation = 1;
			if (state == 0)
				state = 1;
			else if (state == 1)
				state = 2;
			else if (state == 3)
				state = 4;
		}
		break;

	case 3:
		if (state == 2 || state == 3)
		{
			position = 0, rotation = 1;
			state = 1;
		}
		else
		{
			position = 0, rotation = 0;
			if (state == 0)
				state = 2;
			else if (state == 1)
				state = 3;
			else if (state == 4)
				state = 5;
		}
		break;
	default:
		break;
	}
}

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

tetris.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
tetris_c.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
/usr/bin/ld: /tmp/ccr942RS.o: in function `main':
grader.cpp:(.text.startup+0x11e): undefined reference to `get_position()'
/usr/bin/ld: grader.cpp:(.text.startup+0x140): undefined reference to `get_rotation()'
collect2: error: ld returned 1 exit status