Untitled
unknown
plain_text
24 days ago
5.0 kB
6
Indexable
Never
#ifndef _CRT_SECURE_NO_WARNINGS #define _CRT_SECURE_NO_WARNINGS #endif #include <stdio.h> #define MAX_SIZE 1000 extern void init(int N, int mPlane[MAX_SIZE][MAX_SIZE]); extern int getCount(int mPiece[5][5]); extern int getPosition(int mRow, int mCol); #define CMD_INIT 0 #define CMD_CNT 1 #define CMD_POSITION 2 static int Map[MAX_SIZE][MAX_SIZE]; static int Piece[5][5]; static int Data[40000]; static void init_map(int N) { int idx = 0; int x = 0; for (int i = 0; i < (N / 25); i++) { for (int y = 0; y < N; y++) { int data = Data[idx++]; int bit = 1; for (int m = 0; m < 25; m++) { if ((data & bit) != 0) Map[y][x + m] = 1; else Map[y][x + m] = 0; bit <<= 1; } } x += 25; } int dcnt = N % 25; if (dcnt != 0) { for (int y = 0; y < N; y++) { int data = Data[idx++]; int bit = 1; for (int m = 0; m < dcnt; m++) { if ((data & bit) != 0) Map[y][x + m] = 1; else Map[y][x + m] = 0; bit <<= 1; } } } } static void make_piece(int data) { int bit = 1; for (int i = 0; i < 5; i++) { for (int k = 0; k < 5; k++) { if ((data & bit) != 0) Piece[i][k] = 1; else Piece[i][k] = 0; bit <<= 1; } } } static bool run() { int Q, N, row, col, cnt; int ret, ans; bool ok = false; scanf("%d", &Q); for (int q = 0; q < Q; q++) { int cmd; scanf("%d", &cmd); if (cmd == CMD_INIT) { scanf("%d %d", &N, &cnt); for (int i = 0; i < cnt; i++) scanf("%d", &Data[i]); init_map(N); init(N, Map); ok = true; } else if (cmd == CMD_CNT) { scanf("%d", &Data[0]); make_piece(Data[0]); ret = getCount(Piece); scanf("%d", &ans); if (ans != ret) { ok = false; } } else if (cmd == CMD_POSITION) { scanf("%d %d", &row, &col); ret = getPosition(row, col); scanf("%d", &ans); if (ans != ret) { ok = false; } } else 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; } /* #ifndef _CRT_SECURE_NO_WARNINGS #define _CRT_SECURE_NO_WARNINGS #endif #include <stdio.h> #define MAX_SIZE 1000 extern void init(int N, int mPlane[MAX_SIZE][MAX_SIZE]); extern int getCount(int mPiece[5][5]); extern int getPosition(int mRow, int mCol); #define CMD_INIT 0 #define CMD_CNT 1 #define CMD_POSITION 2 static int Map[MAX_SIZE][MAX_SIZE]; static int Piece[5][5]; static int Data[40000]; static void init_map(int N) { int idx = 0; int x = 0; for (int i = 0; i < (N / 25); i++) { for (int y = 0; y < N; y++) { int data = Data[idx++]; int bit = 1; for (int m = 0; m < 25; m++) { if ((data & bit) != 0) Map[y][x + m] = 1; else Map[y][x + m] = 0; bit <<= 1; } } x += 25; } int dcnt = N % 25; if (dcnt != 0) { for (int y = 0; y < N; y++) { int data = Data[idx++]; int bit = 1; for (int m = 0; m < dcnt; m++) { if ((data & bit) != 0) Map[y][x + m] = 1; else Map[y][x + m] = 0; bit <<= 1; } } } } static void make_piece(int data) { int bit = 1; for (int i = 0; i < 5; i++) { for (int k = 0; k < 5; k++) { if ((data & bit) != 0) Piece[i][k] = 1; else Piece[i][k] = 0; bit <<= 1; } } } static bool run() { int Q, N, row, col, cnt; int ret, ans; bool ok = false; scanf("%d", &Q); for (int q = 0; q < Q; q++) { int cmd; scanf("%d", &cmd); if (cmd == CMD_INIT) { scanf("%d %d", &N, &cnt); for (int i = 0; i < cnt; i++) scanf("%d", &Data[i]); init_map(N); init(N, Map); ok = true; } else if (cmd == CMD_CNT) { scanf("%d", &Data[0]); make_piece(Data[0]); ret = getCount(Piece); scanf("%d", &ans); if (ans != ret) { ok = false; } } else if (cmd == CMD_POSITION) { scanf("%d %d", &row, &col); ret = getPosition(row, col); scanf("%d", &ans); if (ans != ret) { ok = false; } } else 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; } */ #define MAX_SIZE 1000 void init(int N, int mPlane[MAX_SIZE][MAX_SIZE]) { } int getCount(int mPiece[5][5]) { return 0; } int getPosition(int mRow, int mCol) { return 0; } 25 100 11 0 20 20 278560 65544 65568 66570 280624 4096 1280 791074 0 28 0 1015842 0 512 533 279056 287242 270848 262152 262144 1 8922196 1 1 32505859 0 2 9 1 20016 1 17840145 2 2 13 11 90017 2 15 2 20003 1 19046660 0 2 6 11 50010 1 17318449 3 1 1181315 2
Leave a Comment