답안 #949860

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
949860 2024-03-19T19:07:46 Z midi Mini tetris (IOI16_tetris) C++14
컴파일 오류
0 ms 0 KB
#include "tetris_c.h"
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
#define vc vector
typedef vc<ll> vcll;
typedef vc<bool> vcb;
#define pr pair
typedef pr<ll, ll> prll;
typedef map<ll,ll> mapll;
#define umap unordered_map
typedef umap<ll,ll> umapll;

#define f0r(i,a,n) for ((i)=(a); (i)<=(n); (i)++)
#define r0f(i,n,a) for ((i)=(n); (i)>=(a); (i)--)

#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define mp make_pair
#define fi first
#define se second
#define sz size
#define all(x) (x).begin(), (x).end()
#define all0(x, n) (x).begin(), (x).begin()+n
#define all1(x, n) (x).begin()+1, (x).begin()+n+1
#define allrev(x) (x).rbegin(), (x).rend()
#define in(v, s) ((s).find((v)) != (s).end())
#define GCD(x, y) __gcd(abs((x)), abs((y)))

#define INF (LLONG_MAX>>3ll)
#define MOD 1'000'000'007ll

#define mxN 100'010ll

inline void maxa(ll &a, ll b) { if (a<b) a=b; }
inline void mina(ll &a, ll b) { if (a>b) a=b; }

ll n;

enum state
{ 
	e,

	left1,
	right1,

	left2,
	right2,

	left_corner,
	right_corner,
};

state gr;
prll res;

inline void init (int N)
{
	gr=e;
}

inline void new_figure (int id)
{
	if (id==1) return void (res = {0, 0});

	if (id==2)
	{
		if (gr==e)
		{
			res = {0, 0};
			gr=right2;
			return;
		}

		if (gr==left1)
		{
			res = {1, 0};
			gr=e;
			return;
		}
		if (gr==right1)
		{
			res = {0, 0};
			gr=e;
			return;
		}

		if (gr==left2)
		{
			res = {2, 1};
			gr=right1;
			return;
		}
		if (gr==right2)
		{
			res = {0, 1};
			gr=left1;
			return;
		}

		if (gr==left_corner)
		{
			res = {1, 0};
			gr=left2;
			return;
		}
		if (gr==right_corner)
		{
			res = {0, 0};
			gr=right2;
			return;
		}

		assert(0);
	}

	if (gr==e)
	{
		res = {0, 0};
		gr=left_corner;
		return;
	}

	if (gr==left1)
	{
		res = {1, 1};
		gr=right1;
		return;
	}
	if (gr==right1)
	{
		res = {0, 0};
		gr=left1;
		return;
	}

	if (gr==left2)
	{
		res = {2, 2};
		gr=right2;
		return;
	}
	if (gr==right2)
	{
		res = {0, 3};
		gr=left2;
		return;
	}

	if (gr==left_corner)
	{
		res = {2, 2};
		gr=e;
		return;
	}
	if (gr==right_corner)
	{
		res = {0, 3};
		gr=e;
		return;
	}
}

inline int get_position() { return res.fi; }
inline int get_rotation() { return res.se; }

inline void pos ()
{
	ll ans=get_position();
	printf("position is ans: %lli\n", ans);
}

inline void rot ()
{
	ll ans=get_rotation();
	printf("rotation is ans: %lli\n", ans);
}

inline void fig (ll id)
{
	printf("figure id: %lli\n", id);
	new_figure (id);
	pos();
	rot();
	printf("\n");
}

/*
int main()
{
	cin.tie(0); cout.tie(0);
	ios_base::sync_with_stdio(0);
	srand(time(0));

	// freopen("file.in", "r", stdin);

	init(3);

	fig(1);
	fig(3);
	fig(2);
	fig(3);
	fig(3);

	return 0;
}
*/

Compilation message

/usr/bin/ld: /tmp/ccV6uvFq.o: in function `main':
grader.cpp:(.text.startup+0xd6): undefined reference to `init(int)'
/usr/bin/ld: grader.cpp:(.text.startup+0x11d): undefined reference to `new_figure(int)'
/usr/bin/ld: grader.cpp:(.text.startup+0x122): undefined reference to `get_position()'
/usr/bin/ld: grader.cpp:(.text.startup+0x14c): undefined reference to `get_rotation()'
collect2: error: ld returned 1 exit status