답안 #949866

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
949866 2024-03-19T19:12:38 Z midi Mini tetris (IOI16_tetris) C++14
7 / 100
2 ms 600 KB
#include "tetris.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;

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

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;
	}
}

int get_position() { return res.fi; }
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;
}
*/
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Win!
2 Correct 0 ms 348 KB Win!
3 Correct 0 ms 344 KB Win!
4 Correct 0 ms 348 KB Win!
5 Correct 1 ms 348 KB Win!
6 Correct 1 ms 600 KB Win!
7 Correct 1 ms 348 KB Win!
8 Correct 2 ms 348 KB Win!
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Game over! After 5 turns.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Win!
2 Correct 0 ms 348 KB Win!
3 Correct 0 ms 344 KB Win!
4 Correct 0 ms 348 KB Win!
5 Correct 1 ms 348 KB Win!
6 Correct 1 ms 600 KB Win!
7 Correct 1 ms 348 KB Win!
8 Correct 2 ms 348 KB Win!
9 Incorrect 0 ms 348 KB Game over! After 5 turns.
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Bad position for figure 3 : 2
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Win!
2 Correct 0 ms 348 KB Win!
3 Correct 0 ms 344 KB Win!
4 Correct 0 ms 348 KB Win!
5 Correct 1 ms 348 KB Win!
6 Correct 1 ms 600 KB Win!
7 Correct 1 ms 348 KB Win!
8 Correct 2 ms 348 KB Win!
9 Incorrect 0 ms 348 KB Game over! After 5 turns.
10 Halted 0 ms 0 KB -