Submission #949870

# Submission time Handle Problem Language Result Execution time Memory
949870 2024-03-19T19:26:36 Z midi Mini tetris (IOI16_tetris) C++14
100 / 100
2 ms 348 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=left2;
			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 = {1, 2};
		gr=right2;
		return;
	}
	if (gr==right2)
	{
		res = {0, 3};
		gr=left2;
		return;
	}

	if (gr==left_corner)
	{
		res = {1, 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(3);
	fig(3);
	fig(3);
	fig(3);
	fig(3);
	fig(3);

	return 0;
}
*/
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Win!
2 Correct 0 ms 348 KB Win!
3 Correct 1 ms 344 KB Win!
4 Correct 0 ms 348 KB Win!
5 Correct 0 ms 348 KB Win!
6 Correct 1 ms 348 KB Win!
7 Correct 1 ms 348 KB Win!
8 Correct 2 ms 348 KB Win!
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Win!
2 Correct 0 ms 348 KB Win!
3 Correct 1 ms 348 KB Win!
4 Correct 0 ms 348 KB Win!
5 Correct 0 ms 348 KB Win!
6 Correct 1 ms 348 KB Win!
7 Correct 1 ms 344 KB Win!
8 Correct 2 ms 348 KB Win!
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Win!
2 Correct 0 ms 348 KB Win!
3 Correct 1 ms 344 KB Win!
4 Correct 0 ms 348 KB Win!
5 Correct 0 ms 348 KB Win!
6 Correct 1 ms 348 KB Win!
7 Correct 1 ms 348 KB Win!
8 Correct 2 ms 348 KB Win!
9 Correct 1 ms 348 KB Win!
10 Correct 0 ms 348 KB Win!
11 Correct 1 ms 348 KB Win!
12 Correct 0 ms 348 KB Win!
13 Correct 0 ms 348 KB Win!
14 Correct 1 ms 348 KB Win!
15 Correct 1 ms 344 KB Win!
16 Correct 2 ms 348 KB Win!
17 Correct 0 ms 344 KB Win!
18 Correct 0 ms 348 KB Win!
19 Correct 0 ms 348 KB Win!
20 Correct 1 ms 348 KB Win!
21 Correct 0 ms 348 KB Win!
22 Correct 1 ms 344 KB Win!
23 Correct 1 ms 344 KB Win!
24 Correct 2 ms 344 KB Win!
25 Correct 2 ms 348 KB Win!
26 Correct 2 ms 348 KB Win!
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Win!
2 Correct 1 ms 344 KB Win!
3 Correct 1 ms 348 KB Win!
4 Correct 0 ms 348 KB Win!
5 Correct 1 ms 348 KB Win!
6 Correct 1 ms 344 KB Win!
7 Correct 1 ms 348 KB Win!
8 Correct 2 ms 348 KB Win!
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Win!
2 Correct 0 ms 348 KB Win!
3 Correct 1 ms 344 KB Win!
4 Correct 0 ms 348 KB Win!
5 Correct 0 ms 348 KB Win!
6 Correct 1 ms 348 KB Win!
7 Correct 1 ms 348 KB Win!
8 Correct 2 ms 348 KB Win!
9 Correct 1 ms 348 KB Win!
10 Correct 0 ms 348 KB Win!
11 Correct 1 ms 348 KB Win!
12 Correct 0 ms 348 KB Win!
13 Correct 0 ms 348 KB Win!
14 Correct 1 ms 348 KB Win!
15 Correct 1 ms 344 KB Win!
16 Correct 2 ms 348 KB Win!
17 Correct 0 ms 344 KB Win!
18 Correct 0 ms 348 KB Win!
19 Correct 0 ms 348 KB Win!
20 Correct 1 ms 348 KB Win!
21 Correct 0 ms 348 KB Win!
22 Correct 1 ms 344 KB Win!
23 Correct 1 ms 344 KB Win!
24 Correct 2 ms 344 KB Win!
25 Correct 2 ms 348 KB Win!
26 Correct 2 ms 348 KB Win!
27 Correct 1 ms 348 KB Win!
28 Correct 1 ms 344 KB Win!
29 Correct 1 ms 348 KB Win!
30 Correct 0 ms 348 KB Win!
31 Correct 1 ms 348 KB Win!
32 Correct 1 ms 344 KB Win!
33 Correct 1 ms 348 KB Win!
34 Correct 2 ms 348 KB Win!
35 Correct 1 ms 344 KB Win!
36 Correct 0 ms 348 KB Win!
37 Correct 0 ms 348 KB Win!
38 Correct 1 ms 348 KB Win!
39 Correct 0 ms 348 KB Win!
40 Correct 1 ms 348 KB Win!
41 Correct 1 ms 348 KB Win!
42 Correct 2 ms 348 KB Win!
43 Correct 2 ms 348 KB Win!
44 Correct 2 ms 348 KB Win!
45 Correct 2 ms 348 KB Win!