답안 #646545

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
646545 2022-09-30T03:16:48 Z Do_you_copy Mini tetris (IOI16_tetris) C++17
0 / 100
1 ms 300 KB
#include <bits/stdc++.h>
//#define int long long
#define pb push_back
#define fi first
#define se second
#define faster ios_base::sync_with_stdio(0); cin.tie(0);

using namespace std;
using ll = long long;
using pii = pair <int, int>;
mt19937_64 Rand(chrono::steady_clock::now().time_since_epoch().count());

inline ll max(const ll &a, const ll &b){
    return (a > b) ? a : b;
}

inline ll min(const ll &a, const ll &b){
    return (a < b) ? a : b;
}

const int maxN = 1e5 + 1;
//const int Mod = 1e9 + 7;
//const int inf =
int n;

bool bottom[2][3];

vector <pii> fig3 = {{0, 0}, {0, 1}, {1, 0}};

pii nxt[2][2];

void init(int n){
    nxt[0][0] = {0, 1};
    nxt[0][1] = {1, 1};
    nxt[1][1] = {1, 0};
    nxt[1][0] = {0, 0};
}

int position;
int rotation;


void update(){
    if (bottom[0][0] +  bottom[0][1] + bottom[0][2] == 3){
        bottom[0][0] = bottom[1][0];
        bottom[0][1] = bottom[1][1];
        bottom[0][2] = bottom[1][2];
    }
    if (bottom[0][0] +  bottom[0][1] + bottom[0][2] == 3){
        bottom[0][0] = bottom[1][0];
        bottom[0][1] = bottom[1][1];
        bottom[0][2] = bottom[1][2];
    }
}

void new_figure(int figure_type){
    update();
    if (figure_type == 1){
        position = 0;
        rotation = 1;
    }
    else if (figure_type == 2){
        if (bottom[0][0] + bottom[0][1] + bottom[0][2] == 2){
            for (int i = 0; i < 3; ++i){
                if (!bottom[0][i]){
                    bottom[0][i] = bottom[1][i] = 1;
                    position = i;
                    rotation = 1;
                }
            }
        }
        else if (bottom[0][0] + bottom[0][1] + bottom[0][2] == 1){
            if (bottom[0][1]){
                bottom[0][0] = bottom[1][0] = 1;
                position = 0;
                rotation = 1;
            }
            if (bottom[0][0]){
                bottom[0][1] = bottom[0][2] = 1;
                position = 1;
                rotation = 0;
            }
            else{
                bottom[0][0] = bottom[0][1] = 1;
                position = 0;
                rotation = 0;
            }
        }
        else{
            bottom[0][0] = bottom[0][1] = 1;
            position = 0;
            rotation = 0;
        }
    }
    else{
        //figure 3;
        vector <pii> tem = fig3;
        for (int i = 0; i <= 3; ++i){
            for (int j = 0; j < 2; ++j){
                position = j;
                rotation = i;
                bool flag = 0;
                for (auto k: tem){
                    if (bottom[k.fi][j + k.se]) flag = 1;
                }
                if (flag) continue;
                flag = (bottom[0][0] + bottom[0][1] + bottom[0][2] == 0);
                for (auto k: tem){
                    bottom[k.fi][j + k.se] = 1;
                }
                if (flag) return;
                flag = (bottom[0][0] + bottom[0][1] + bottom[0][2] == 3);
                if (flag) return;
                for (auto k: tem){
                    bottom[k.fi][j + k.se] = 0;
                }
            }
            for (auto&k: tem){
                k = nxt[k.fi][k.se];
            }
        }
    }
}

int get_position(){
	return position;
}

int get_rotation(){
	return rotation;
}

# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 300 KB Game over! After 2 turns.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Win!
2 Incorrect 0 ms 212 KB Game over! After 8 turns.
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 300 KB Game over! After 2 turns.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Game over! After 5 turns.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 300 KB Game over! After 2 turns.
2 Halted 0 ms 0 KB -