Block Stacking Game
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <stdio.h>
struct Result
{
int top;
int count;
};
void init(int C);
Result dropBlocks(int mCol, int mHeight, int mLength);
#define CMD_INIT 100
#define CMD_DROP 200
static bool run()
{
int query_num;
scanf("%d", &query_num);
int ans_top, ans_count;
bool ok = false;
for (int q = 0; q < query_num; q++)
{
int query;
scanf("%d", &query);
if (query == CMD_INIT)
{
int C;
scanf("%d", &C);
init(C);
ok = true;
}
else if (query == CMD_DROP)
{
int mCol, mHeight, mLength;
scanf("%d %d %d", &mCol, &mHeight, &mLength);
Result ret = dropBlocks(mCol, mHeight, mLength);
scanf("%d %d", &ans_top, &ans_count);
if (ans_top != ret.top || ans_count != ret.count)
{
ok = false;
}
}
}
return ok;
}
int main()
{
setbuf(stdout, NULL);
// freopen("sample_input.txt", "r", stdin);
int T, MARK;
scanf("%d %d", &T, &MARK);
for (int tc = 1; tc <= T; tc++)
{
int score = run() ? MARK : 0;
printf("#%d %d\n", tc, score);
}
return 0;
}
struct Result{
int top;
int count;
};
void init(int C)
{
}
Result dropBlocks(int mCol, int mHeight, int mLength)
{
Result ret;
ret.top = 0;
ret.count = 0;
return ret;
}
25 100
13
100 15
200 0 1 5 1 5
200 3 2 4 3 13
200 2 1 6 4 19
200 7 2 8 3 20
200 0 3 15 3 20
200 5 1 10 3 30
200 8 1 7 3 37
200 0 2 3 1 13
200 0 1 2 0 0
200 0 2 15 0 0
200 1 3 13 3 39
200 2 3 4 6 51
11
100 10
200 5 2 5 2 10
200 4 2 5 4 20
200 0 2 8 4 16
200 3 2 7 6 30
200 0 3 10 6 30
200 2 1 6 7 36
200 0 3 9 8 43
200 0 3 9 11 70
200 3 1 3 12 73
200 0 1 10 12 73