90 lines
2.4 KiB
C
90 lines
2.4 KiB
C
// Created by Synth Magic
|
|
// 2024-11-27 22:57
|
|
// TODO: Refactor the code by need
|
|
// TODO: Add ExceptionHandler on windows and signal system on linux
|
|
#include <ctype.h>
|
|
#include <minwindef.h>
|
|
#include <stdarg.h>
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <time.h>
|
|
#include <vadefs.h>
|
|
#define MAX_IONUM 100000
|
|
// Time Limit (normally 1s)
|
|
// 题目的时限(通常为1秒)
|
|
const unsigned int case_millseconds = 1000;
|
|
unsigned int curr_testcase = 0, sum_mark = 0;
|
|
size_t cur_output = 0;
|
|
#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN64)
|
|
#include <windows.h>
|
|
HANDLE child_stdout_r = NULL;
|
|
void create_process() {
|
|
PROCESS_INFORMATION piProcInfo;
|
|
STARTUPINFO siStartInfo;
|
|
BOOL bSuccess = FALSE;
|
|
ZeroMemory(&piProcInfo, sizeof(PROCESS_INFORMATION));
|
|
ZeroMemory(&siStartInfo, sizeof(STARTUPINFO));
|
|
}
|
|
#elif defined(__linux__)
|
|
#warning not finished
|
|
#endif
|
|
#if defined(__APPLE__) || defined(__MACH__) || defined(BSD)
|
|
#error Unsupported OS
|
|
#endif
|
|
char *trim(char *s) {
|
|
while (isspace(*s))
|
|
s++;
|
|
char *back = s + strlen(s);
|
|
while (isspace(*--back))
|
|
;
|
|
*(back + 1) = '\0';
|
|
return s;
|
|
}
|
|
unsigned int crc32f(unsigned char *message) {
|
|
int i = 0, j;
|
|
unsigned int byte, crc = 0xFFFFFFFF, mask;
|
|
while (message[i] != 0) {
|
|
byte = message[i];
|
|
crc = crc ^ byte;
|
|
for (j = 7; j >= 0; j--) {
|
|
mask = -(crc & 1);
|
|
crc = (crc >> 1) ^ (0xEDB88320 & mask);
|
|
}
|
|
i = i + 1;
|
|
}
|
|
return ~crc;
|
|
}
|
|
int a_plus_b(int a, int b) { return a + b; }
|
|
/**
|
|
TESTCASE(1) {
|
|
|
|
}
|
|
subprocess:
|
|
if result present in time limit * 2 : print crc and time
|
|
if not present & still running : TLE
|
|
if exit != 0 : RE
|
|
*/
|
|
|
|
#define BEGIN_TESTCASE switch (atoi(argv[2])) {
|
|
#define TESTCASE(i, x) \
|
|
case i: { \
|
|
x; \
|
|
break; \
|
|
}
|
|
#define END_TESTCASE \
|
|
default: \
|
|
break; \
|
|
}
|
|
void test() {}
|
|
int main(int argc, const char *argv[]) {
|
|
if (argc == 3) {
|
|
BEGIN_TESTCASE
|
|
TESTCASE(1, printf("1"))
|
|
END_TESTCASE
|
|
} else {
|
|
}
|
|
}
|