답안 #1073569

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1073569 2024-08-24T16:12:39 Z Osplei Mini tetris (IOI16_tetris) C++17
46 / 100
2 ms 428 KB
#include "tetris.h"
#include <bits/stdc++.h>
 
using namespace std;
 
typedef pair<int,int> ii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii; 
typedef vector<vii> wgraf;
typedef pair<int,ii> edge;
typedef vector <ll> vl;
typedef pair <ll, ll> LL;
typedef vector <LL> vll;
 
#define UNVISITED 0
#define VISITED 1
#define pb push_back
#define F first
#define S second

bool libre[3], libre2[3];

void init(int n) {
  libre[0] = true;
  libre[1] = true;
  libre[2] = true;

  libre2[0] = true;
  libre2[1] = true;
  libre2[2] = true;
}

ll pos = 0, rot = 0, cnt = 0;

void new_figure(int figure_type) {

  cnt = 0;
  for (ll i = 0; i < 3; i++) if (libre[i] == true) cnt++;

  if (figure_type == 1){

    pos = 0;
    rot = 0;

  } else if (figure_type == 2){
  
    if (cnt >= 2) {
      
      if (libre[0] == true) pos = 0;
      else pos = 1;
      rot = 0;

      if (cnt == 2) {

        libre[0] = libre2[0];
        libre[1] = libre2[1];
        libre[2] = libre2[2];

        libre2[0] = true;
        libre2[1] = true;
        libre2[2] = true;

      } else {

        libre[pos] = false;
        libre[pos + 1] = false; 

      }

    } else {

      if (libre2[2] == false && libre2[1] == true && libre2[0] == true) {

        pos = 0;
        rot = 0;
        libre2[2] = true;

      } else if (libre2[0] == false && libre2[1] == true && libre2[2] == true) {

        pos = 1;
        rot = 0;
        libre2[0] = true;

      } else {
      
        if (libre[0] == true) pos = 0;
        else pos = 2;
        rot = 1;
        
        libre[0] = libre2[0];
        libre[1] = libre2[1];
        libre[2] = libre2[2];

        libre[pos] = false;
      
      }
    
    }

  } else {
    
    if (cnt == 3){

      libre2[0] = false;

      libre[0] = false;
      libre[1] = false;

      pos = 0;
      rot = 0;

    } else if (cnt == 2){

      libre[2] = false;

      libre[0] = libre2[0];
      libre[1] = libre2[1];

      libre2[0] = true;
      libre2[1] = true;

      pos = 1;
      rot = 1;

    } else {
      
      if (libre[2] == true) {

        pos = 1;
        rot = 2;
        libre[0] = true;
        libre[1] = false;
        libre[2] = false;

      } else {

        pos = 0;
        rot = 3;
        libre[0] = false;
        libre[1] = false;
        libre[2] = true;

      }

      libre2[0] = true;
      libre2[1] = true;
      libre2[2] = true;

    }
  }
}

int get_position() {
	return pos;
}

int get_rotation() {
	return rot;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Win!
2 Correct 0 ms 344 KB Win!
3 Correct 0 ms 348 KB Win!
4 Correct 0 ms 348 KB Win!
5 Correct 0 ms 348 KB Win!
6 Correct 1 ms 348 KB Win!
7 Correct 1 ms 348 KB Win!
8 Correct 1 ms 348 KB Win!
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Win!
2 Correct 0 ms 348 KB Win!
3 Correct 0 ms 348 KB Win!
4 Correct 0 ms 348 KB Win!
5 Correct 0 ms 428 KB Win!
6 Correct 1 ms 348 KB Win!
7 Correct 2 ms 348 KB Win!
8 Correct 1 ms 348 KB Win!
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Win!
2 Correct 0 ms 344 KB Win!
3 Correct 0 ms 348 KB Win!
4 Correct 0 ms 348 KB Win!
5 Correct 0 ms 348 KB Win!
6 Correct 1 ms 348 KB Win!
7 Correct 1 ms 348 KB Win!
8 Correct 1 ms 348 KB Win!
9 Correct 0 ms 348 KB Win!
10 Correct 0 ms 348 KB Win!
11 Correct 0 ms 348 KB Win!
12 Correct 0 ms 348 KB Win!
13 Correct 0 ms 428 KB Win!
14 Correct 1 ms 348 KB Win!
15 Correct 2 ms 348 KB Win!
16 Correct 1 ms 348 KB Win!
17 Correct 0 ms 348 KB Win!
18 Correct 0 ms 348 KB Win!
19 Correct 0 ms 348 KB Win!
20 Correct 0 ms 348 KB Win!
21 Correct 0 ms 348 KB Win!
22 Correct 1 ms 348 KB Win!
23 Correct 1 ms 348 KB Win!
24 Correct 1 ms 348 KB Win!
25 Correct 1 ms 348 KB Win!
26 Correct 1 ms 348 KB Win!
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Win!
2 Correct 1 ms 348 KB Win!
3 Correct 0 ms 348 KB Win!
4 Correct 0 ms 348 KB Win!
5 Correct 0 ms 348 KB Win!
6 Correct 1 ms 348 KB Win!
7 Correct 1 ms 348 KB Win!
8 Correct 1 ms 348 KB Win!
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Win!
2 Correct 0 ms 344 KB Win!
3 Correct 0 ms 348 KB Win!
4 Correct 0 ms 348 KB Win!
5 Correct 0 ms 348 KB Win!
6 Correct 1 ms 348 KB Win!
7 Correct 1 ms 348 KB Win!
8 Correct 1 ms 348 KB Win!
9 Correct 0 ms 348 KB Win!
10 Correct 0 ms 348 KB Win!
11 Correct 0 ms 348 KB Win!
12 Correct 0 ms 348 KB Win!
13 Correct 0 ms 428 KB Win!
14 Correct 1 ms 348 KB Win!
15 Correct 2 ms 348 KB Win!
16 Correct 1 ms 348 KB Win!
17 Correct 0 ms 348 KB Win!
18 Correct 0 ms 348 KB Win!
19 Correct 0 ms 348 KB Win!
20 Correct 0 ms 348 KB Win!
21 Correct 0 ms 348 KB Win!
22 Correct 1 ms 348 KB Win!
23 Correct 1 ms 348 KB Win!
24 Correct 1 ms 348 KB Win!
25 Correct 1 ms 348 KB Win!
26 Correct 1 ms 348 KB Win!
27 Correct 0 ms 348 KB Win!
28 Correct 1 ms 348 KB Win!
29 Correct 0 ms 348 KB Win!
30 Correct 0 ms 348 KB Win!
31 Correct 0 ms 348 KB Win!
32 Correct 1 ms 348 KB Win!
33 Correct 1 ms 348 KB Win!
34 Correct 1 ms 348 KB Win!
35 Correct 0 ms 348 KB Win!
36 Correct 0 ms 348 KB Win!
37 Correct 0 ms 348 KB Win!
38 Incorrect 0 ms 348 KB Game over! After 8 turns.
39 Halted 0 ms 0 KB -