Submission #646545

#TimeUsernameProblemLanguageResultExecution timeMemory
646545Do_you_copyMini tetris (IOI16_tetris)C++17
0 / 100
1 ms300 KiB
#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; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...