제출 #1187609

#제출 시각아이디문제언어결과실행 시간메모리
1187609weakweakweakMini tetris (IOI16_tetris)C++20
46 / 100
1 ms328 KiB
#include "tetris.h"
#include <iostream>

void init(int n) {
}

int position;
int rotation;
int type = 0; // 0 是空白,1 是 只有一個在邊邊, 2 是兩個在邊邊,3 是小階梯
int left = 0;

void new_figure(int figure_type) {
	if (figure_type == 1) {
		position = 0, rotation = 0;
		return;
	}
	if (figure_type == 2) {
		if (type == 0) {
			position = 0;
			rotation = 0;
			type = 2, left = 1;
		}
		else if (type == 1) {
			if (left) {
				position = 1, rotation = 0;
				type = 0;
			}
			else{
				position = 0, rotation = 0;
				type = 0;
			}
		}
		else if (type == 2) {
			if (left) {
				position = 2, rotation = 1;
				type = 1, left = 0;
			}
			else {
				position = 0, rotation = 1;
				type = 1, left = 1;
			}
		}
		else {
			if (left) {
				position = 1, rotation = 0;
				type = 2, left = 1;
			}
			else {
				position = 0, rotation = 0;
				type = 2, left = 0;
			}
		}
	}
	else {
		if (type == 0) {
			position = 0;
			rotation = 0;
			type = 3, left = 1;
		}
		else if (type == 1) {
			if (left) {
				position = 1, rotation = 3;
				type = 1, left = 0;
			}
			else{
				position = 0, rotation = 0;
				type = 1, left = 1;
			}
		}
		else if (type == 2) {
			if (left) {
				position = 1, rotation = 1;
				type = 2, left = 0;
			}
			else {
				position = 0, rotation = 3;
				type = 2, left = 1;
			}
		}
		else {
			if (left) {
				position = 1, rotation = 2;
				type = 0;
			}
			else {
				position = 0, rotation = 3;
				type = 0;
			}
		}
	}
}

int get_position() {
	return position;
}

int get_rotation() {
	return rotation;
}

컴파일 시 표준 에러 (stderr) 메시지

tetris.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
tetris_c.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
#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...