This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 = {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(2);
	fig(2);
	fig(2);
	fig(2);
	fig(2);
	fig(2);
	fig(2);
	return 0;
}
*/
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... |