Submission #526346

# Submission time Handle Problem Language Result Execution time Memory
526346 2022-02-14T12:57:24 Z perchuts Mini tetris (IOI16_tetris) C++17
100 / 100
3 ms 536 KB
#include <bits/stdc++.h>
#define maxn (int)(1e5+51)
#define all(x) x.begin(), x.end()
#define sz(x) (int) x.size()
#define endl '\n'
#define ll long long
#define pb push_back
#define ull unsigned long long
#define ii pair<int,int>
#define iii tuple<int,int,int>
#define inf 2000000001
#define mod 1000000007 //998244353
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

using namespace std;

template<typename X, typename Y> bool ckmin(X& x, const Y& y) { return (y < x) ? (x=y,1):0; }
template<typename X, typename Y> bool ckmax(X& x, const Y& y) { return (x < y) ? (x=y,1):0; }

int n,type,newpos,newrotation,mode;

void init(int num){
    n = num;
}

void play(){

    if(type==1){
        newpos = 0;
        newrotation = 0;
        return;
    }

    switch(mode){

        case 0://mode = 0: empty
            if(type==2){
                newpos = 0;
                newrotation = 0;
                mode = 1;
            }else{
                newpos = 1;
                newrotation = 1;
                mode = 4;
            }
            break;

        case 1://mode = 1: figure 2 left
            if(type==2){
                newpos = 2;
                newrotation = 1;
                mode = 6;
            }else{
                newpos = 1;
                newrotation = 2;
                mode = 2;
            }
            break;

        case 2://mode = 2: figure 2 right
            if(type==2){
                newpos = 0;
                newrotation = 1;
                mode = 5;
            }else{
                newpos = 0;
                newrotation = 3;
                mode = 1;
            }
            break;

        //mode = 3: figure 3 left (never used)

        case 4://mode = 4: figure 3 right
            if(type==2){
                newpos = 0;
                newrotation = 0;
                mode = 2;
            }else{
                newpos = 0;
                newrotation = 3;
                mode = 0;
            }
            break;

        case 5://mode = 5: one left
            if(type==2){
                newpos = 1;
                newrotation = 0;
                mode = 0;
            }else{
                newpos = 1;
                newrotation = 1;
                mode = 6;
            }
            break;

        case 6://mode = 6: one right
            if(type==2){
                newpos = 0;
                newrotation = 0;
                mode = 0;
            }else{
                newpos = 0;
                newrotation = 0;
                mode = 5;
            }
            break;
    }
}

void new_figure(int x){
    type = x;
    play();
}

int get_position(){
    return newpos;
}

int get_rotation(){
    return newrotation;
}




# Verdict Execution time Memory Grader output
1 Correct 1 ms 536 KB Win!
2 Correct 1 ms 204 KB Win!
3 Correct 0 ms 204 KB Win!
4 Correct 0 ms 204 KB Win!
5 Correct 1 ms 204 KB Win!
6 Correct 1 ms 204 KB Win!
7 Correct 1 ms 204 KB Win!
8 Correct 2 ms 204 KB Win!
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Win!
2 Correct 1 ms 204 KB Win!
3 Correct 0 ms 204 KB Win!
4 Correct 1 ms 204 KB Win!
5 Correct 1 ms 204 KB Win!
6 Correct 1 ms 204 KB Win!
7 Correct 1 ms 204 KB Win!
8 Correct 2 ms 204 KB Win!
# Verdict Execution time Memory Grader output
1 Correct 1 ms 536 KB Win!
2 Correct 1 ms 204 KB Win!
3 Correct 0 ms 204 KB Win!
4 Correct 0 ms 204 KB Win!
5 Correct 1 ms 204 KB Win!
6 Correct 1 ms 204 KB Win!
7 Correct 1 ms 204 KB Win!
8 Correct 2 ms 204 KB Win!
9 Correct 0 ms 204 KB Win!
10 Correct 1 ms 204 KB Win!
11 Correct 0 ms 204 KB Win!
12 Correct 1 ms 204 KB Win!
13 Correct 1 ms 204 KB Win!
14 Correct 1 ms 204 KB Win!
15 Correct 1 ms 204 KB Win!
16 Correct 2 ms 204 KB Win!
17 Correct 1 ms 204 KB Win!
18 Correct 1 ms 204 KB Win!
19 Correct 1 ms 204 KB Win!
20 Correct 1 ms 204 KB Win!
21 Correct 1 ms 204 KB Win!
22 Correct 1 ms 204 KB Win!
23 Correct 1 ms 204 KB Win!
24 Correct 2 ms 204 KB Win!
25 Correct 2 ms 204 KB Win!
26 Correct 2 ms 204 KB Win!
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Win!
2 Correct 0 ms 204 KB Win!
3 Correct 0 ms 204 KB Win!
4 Correct 0 ms 204 KB Win!
5 Correct 1 ms 204 KB Win!
6 Correct 1 ms 204 KB Win!
7 Correct 1 ms 204 KB Win!
8 Correct 2 ms 204 KB Win!
# Verdict Execution time Memory Grader output
1 Correct 1 ms 536 KB Win!
2 Correct 1 ms 204 KB Win!
3 Correct 0 ms 204 KB Win!
4 Correct 0 ms 204 KB Win!
5 Correct 1 ms 204 KB Win!
6 Correct 1 ms 204 KB Win!
7 Correct 1 ms 204 KB Win!
8 Correct 2 ms 204 KB Win!
9 Correct 0 ms 204 KB Win!
10 Correct 1 ms 204 KB Win!
11 Correct 0 ms 204 KB Win!
12 Correct 1 ms 204 KB Win!
13 Correct 1 ms 204 KB Win!
14 Correct 1 ms 204 KB Win!
15 Correct 1 ms 204 KB Win!
16 Correct 2 ms 204 KB Win!
17 Correct 1 ms 204 KB Win!
18 Correct 1 ms 204 KB Win!
19 Correct 1 ms 204 KB Win!
20 Correct 1 ms 204 KB Win!
21 Correct 1 ms 204 KB Win!
22 Correct 1 ms 204 KB Win!
23 Correct 1 ms 204 KB Win!
24 Correct 2 ms 204 KB Win!
25 Correct 2 ms 204 KB Win!
26 Correct 2 ms 204 KB Win!
27 Correct 0 ms 204 KB Win!
28 Correct 0 ms 204 KB Win!
29 Correct 0 ms 204 KB Win!
30 Correct 0 ms 204 KB Win!
31 Correct 1 ms 204 KB Win!
32 Correct 1 ms 204 KB Win!
33 Correct 1 ms 204 KB Win!
34 Correct 2 ms 204 KB Win!
35 Correct 0 ms 232 KB Win!
36 Correct 1 ms 204 KB Win!
37 Correct 0 ms 204 KB Win!
38 Correct 1 ms 204 KB Win!
39 Correct 1 ms 204 KB Win!
40 Correct 1 ms 204 KB Win!
41 Correct 1 ms 204 KB Win!
42 Correct 2 ms 204 KB Win!
43 Correct 3 ms 288 KB Win!
44 Correct 2 ms 204 KB Win!
45 Correct 2 ms 204 KB Win!