Submission #331278

#TimeUsernameProblemLanguageResultExecution timeMemory
331278Vladth11Mini tetris (IOI16_tetris)C++14
100 / 100
4 ms384 KiB
#include <bits/stdc++.h>
#define debug(x) cerr << #x << " " << x << "\n"
#define debug_with_space(x) cerr << #x << " " << x << " "
#include "tetris.h"

using namespace std;
typedef long long ll;
typedef pair <ll, ll> pii;
typedef pair <ll, pii> piii;

const ll NMAX = 200001;
const ll INF = (1 << 30);
const ll MOD = 1000000007;
const ll BLOCK = 101;
const ll nr_of_bits = 20;
const ll delta = 0.0000001;

string s, last;
int n;
int x;

void init(int _n){
    s = "000";
    last = "000";
    n = _n;
}

void new_figure(int fig){
    x = fig;
}
int get_position(){
    last = s;
    if(x == 1){
        return 0;
    }
    if(s == "000" && x == 2){
        s = "110";
        return 0;
    }
    if(s == "000" && x == 3){
        s = "210";
        return 0;
    }
    if(s == "110" && x == 2){
        s = "001";
        return 2;
    }
    if(s == "110" && x == 3){
        s = "011";
        return 1;
    }
    if(s == "210" && x == 2){
        s = "101";
        return 2;
    }
    if(s == "210" && x == 3){
        s = "000";
        return 1;
    }
    if(s == "001" && x == 2){
        s = "000";
        return 0;
    }
    if(s == "001" && x == 3){
        s = "100";
        return 0;
    }
    if(s == "011" && x == 2){
        s = "100";
        return 0;
    }
     if(s == "011" && x == 3){
        s = "110";
        return 0;
    }
    if(s == "101" && x == 2){
        s = "301";
        return 0;
    }
     if(s == "101" && x == 3){
        s = "110";
        return 0;
    }
    if(s == "100" && x == 2){
        s = "000";
        return 1;
    }
    if(s == "100" && x == 3){
        s = "001";
        return 1;
    }
    if(s == "301" && x == 2){
        s = "210";
        return 1;
    }
    if(s == "301" && x == 3){
        s = "100";
        return 1;
    }
}

int get_rotation(){
    if(x == 1){
        return 0;
    }
    if(last == "000" && x == 2){
        return 0;
    }
    if(last == "000" && x == 3){
        return 0;
    }
    if(last == "110" && x == 2){
        return 1;
    }
    if(last == "110" && x == 3){
        return 2;
    }
    if(last == "210" && x == 2){
        return 1;
    }
    if(last == "210" && x == 3){
        return 2;
    }
    if(last == "001" && x == 2){
        last = "000";
        return 0;
    }
    if(last == "001" && x == 3){
        return 0;
    }
    if(last == "011" && x == 2){
        return 1;
    }
     if(last == "011" && x == 3){
        return 3;
    }
    if(last == "101" && x == 2){
        return 1;
    }
     if(last == "101" && x == 3){
        return 2;
    }
    if(last == "100" && x == 2){
        return 0;
    }
    if(last == "100" && x == 3){
        return 1;
    }
    if(last == "301" && x == 2){
        return 1;
    }
    if(last == "301" && x == 3){
        return 3;
    }
}

Compilation message (stderr)

tetris.cpp: In function 'int get_position()':
tetris.cpp:100:1: warning: control reaches end of non-void function [-Wreturn-type]
  100 | }
      | ^
tetris.cpp: In function 'int get_rotation()':
tetris.cpp:155:1: warning: control reaches end of non-void function [-Wreturn-type]
  155 | }
      | ^
#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...