답안 #526345

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
526345 2022-02-14T12:52:05 Z perchuts Mini tetris (IOI16_tetris) C++17
46 / 100
2 ms 488 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 = 1;
                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;
}




# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 488 KB Win!
2 Correct 1 ms 204 KB Win!
3 Correct 1 ms 292 KB Win!
4 Correct 1 ms 292 KB Win!
5 Correct 1 ms 204 KB Win!
6 Correct 1 ms 204 KB Win!
7 Correct 1 ms 288 KB Win!
8 Correct 2 ms 204 KB Win!
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Win!
2 Correct 0 ms 204 KB Win!
3 Correct 1 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 2 ms 292 KB Win!
8 Correct 2 ms 288 KB Win!
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 488 KB Win!
2 Correct 1 ms 204 KB Win!
3 Correct 1 ms 292 KB Win!
4 Correct 1 ms 292 KB Win!
5 Correct 1 ms 204 KB Win!
6 Correct 1 ms 204 KB Win!
7 Correct 1 ms 288 KB Win!
8 Correct 2 ms 204 KB Win!
9 Correct 1 ms 204 KB Win!
10 Correct 0 ms 204 KB Win!
11 Correct 1 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 2 ms 292 KB Win!
16 Correct 2 ms 288 KB Win!
17 Correct 1 ms 288 KB Win!
18 Correct 1 ms 296 KB Win!
19 Correct 0 ms 204 KB Win!
20 Correct 1 ms 296 KB Win!
21 Correct 1 ms 204 KB Win!
22 Correct 1 ms 296 KB Win!
23 Correct 1 ms 204 KB Win!
24 Correct 2 ms 292 KB Win!
25 Correct 2 ms 204 KB Win!
26 Correct 2 ms 288 KB Win!
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Win!
2 Correct 1 ms 204 KB Win!
3 Correct 1 ms 204 KB Win!
4 Correct 1 ms 292 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!
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 488 KB Win!
2 Correct 1 ms 204 KB Win!
3 Correct 1 ms 292 KB Win!
4 Correct 1 ms 292 KB Win!
5 Correct 1 ms 204 KB Win!
6 Correct 1 ms 204 KB Win!
7 Correct 1 ms 288 KB Win!
8 Correct 2 ms 204 KB Win!
9 Correct 1 ms 204 KB Win!
10 Correct 0 ms 204 KB Win!
11 Correct 1 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 2 ms 292 KB Win!
16 Correct 2 ms 288 KB Win!
17 Correct 1 ms 288 KB Win!
18 Correct 1 ms 296 KB Win!
19 Correct 0 ms 204 KB Win!
20 Correct 1 ms 296 KB Win!
21 Correct 1 ms 204 KB Win!
22 Correct 1 ms 296 KB Win!
23 Correct 1 ms 204 KB Win!
24 Correct 2 ms 292 KB Win!
25 Correct 2 ms 204 KB Win!
26 Correct 2 ms 288 KB Win!
27 Correct 1 ms 204 KB Win!
28 Correct 1 ms 204 KB Win!
29 Correct 1 ms 204 KB Win!
30 Correct 1 ms 292 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 204 KB Win!
36 Correct 0 ms 204 KB Win!
37 Correct 1 ms 204 KB Win!
38 Incorrect 1 ms 204 KB Game over! After 17 turns.
39 Halted 0 ms 0 KB -