답안 #331278

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
331278 2020-11-27T21:30:43 Z Vladth11 Mini tetris (IOI16_tetris) C++14
100 / 100
4 ms 384 KB
#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

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 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Win!
2 Correct 1 ms 364 KB Win!
3 Correct 1 ms 364 KB Win!
4 Correct 1 ms 364 KB Win!
5 Correct 1 ms 364 KB Win!
6 Correct 1 ms 364 KB Win!
7 Correct 3 ms 372 KB Win!
8 Correct 3 ms 364 KB Win!
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Win!
2 Correct 1 ms 364 KB Win!
3 Correct 1 ms 364 KB Win!
4 Correct 1 ms 364 KB Win!
5 Correct 1 ms 364 KB Win!
6 Correct 2 ms 364 KB Win!
7 Correct 3 ms 364 KB Win!
8 Correct 3 ms 364 KB Win!
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Win!
2 Correct 1 ms 364 KB Win!
3 Correct 1 ms 364 KB Win!
4 Correct 1 ms 364 KB Win!
5 Correct 1 ms 364 KB Win!
6 Correct 1 ms 364 KB Win!
7 Correct 3 ms 372 KB Win!
8 Correct 3 ms 364 KB Win!
9 Correct 1 ms 364 KB Win!
10 Correct 1 ms 364 KB Win!
11 Correct 1 ms 364 KB Win!
12 Correct 1 ms 364 KB Win!
13 Correct 1 ms 364 KB Win!
14 Correct 2 ms 364 KB Win!
15 Correct 3 ms 364 KB Win!
16 Correct 3 ms 364 KB Win!
17 Correct 1 ms 364 KB Win!
18 Correct 1 ms 364 KB Win!
19 Correct 1 ms 364 KB Win!
20 Correct 1 ms 364 KB Win!
21 Correct 1 ms 364 KB Win!
22 Correct 1 ms 364 KB Win!
23 Correct 2 ms 364 KB Win!
24 Correct 3 ms 364 KB Win!
25 Correct 3 ms 364 KB Win!
26 Correct 3 ms 364 KB Win!
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Win!
2 Correct 1 ms 364 KB Win!
3 Correct 1 ms 364 KB Win!
4 Correct 1 ms 364 KB Win!
5 Correct 1 ms 364 KB Win!
6 Correct 1 ms 364 KB Win!
7 Correct 2 ms 364 KB Win!
8 Correct 3 ms 364 KB Win!
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Win!
2 Correct 1 ms 364 KB Win!
3 Correct 1 ms 364 KB Win!
4 Correct 1 ms 364 KB Win!
5 Correct 1 ms 364 KB Win!
6 Correct 1 ms 364 KB Win!
7 Correct 3 ms 372 KB Win!
8 Correct 3 ms 364 KB Win!
9 Correct 1 ms 364 KB Win!
10 Correct 1 ms 364 KB Win!
11 Correct 1 ms 364 KB Win!
12 Correct 1 ms 364 KB Win!
13 Correct 1 ms 364 KB Win!
14 Correct 2 ms 364 KB Win!
15 Correct 3 ms 364 KB Win!
16 Correct 3 ms 364 KB Win!
17 Correct 1 ms 364 KB Win!
18 Correct 1 ms 364 KB Win!
19 Correct 1 ms 364 KB Win!
20 Correct 1 ms 364 KB Win!
21 Correct 1 ms 364 KB Win!
22 Correct 1 ms 364 KB Win!
23 Correct 2 ms 364 KB Win!
24 Correct 3 ms 364 KB Win!
25 Correct 3 ms 364 KB Win!
26 Correct 3 ms 364 KB Win!
27 Correct 1 ms 364 KB Win!
28 Correct 1 ms 364 KB Win!
29 Correct 1 ms 364 KB Win!
30 Correct 1 ms 364 KB Win!
31 Correct 1 ms 364 KB Win!
32 Correct 1 ms 364 KB Win!
33 Correct 2 ms 364 KB Win!
34 Correct 3 ms 364 KB Win!
35 Correct 1 ms 384 KB Win!
36 Correct 1 ms 256 KB Win!
37 Correct 1 ms 256 KB Win!
38 Correct 1 ms 364 KB Win!
39 Correct 1 ms 364 KB Win!
40 Correct 1 ms 364 KB Win!
41 Correct 2 ms 364 KB Win!
42 Correct 4 ms 364 KB Win!
43 Correct 3 ms 364 KB Win!
44 Correct 3 ms 364 KB Win!
45 Correct 3 ms 364 KB Win!