Submission #67245890


Source Code Expand

Copy
#include <stdio.h>
#include <stdlib.h>
struct str_s {
char* str;
struct str_s* next;
};
void print_str(const struct str_s* s) {
if (s != NULL) {
print_str(s->next);
fputs(s->str, stdout);
}
}
struct str_s* server;
struct str_s* pc[212345];
char s[1123456];
int main(void) {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include <stdio.h>
#include <stdlib.h>

struct str_s {
	char* str;
	struct str_s* next;
};

void print_str(const struct str_s* s) {
	if (s != NULL) {
		print_str(s->next);
		fputs(s->str, stdout);
	}
}

struct str_s* server;
struct str_s* pc[212345];

char s[1123456];

int main(void) {
	int N, Q;
	int i;
	if (scanf("%d%d", &N, &Q) != 2) return 1;
	for (i = 0; i < Q; i++) {
		int type;
		int p;
		if (scanf("%d%d", &type, &p) != 2) return 1;
		switch (type) {
			case 1:
				pc[p] = server;
				break;
			case 2:
				if (scanf("%1123455s", s) != 1) return 1;
				{
					size_t len = strlen(s);
					struct str_s* node = malloc(sizeof(*node));
					if (node == NULL) return 2;
					node->str = malloc(len + 1);
					if (node->str == NULL) return 2;
					strcpy(node->str, s);
					node->next = pc[p];
					pc[p] = node;
				}
				break;
			case 3:
				server = pc[p];
				break;
		}
	}
	print_str(server);
	putchar('\n');
	return 0;
}

Submission Info

Submission Time
Task D - Conflict 2
User mikecat
Language C (gcc 12.2.0)
Score 425
Code Size 990 Byte
Status AC
Exec Time 56 ms
Memory 18020 KiB

Compile Error

Main.c: In function ‘main’:
Main.c:36:54: warning: implicit declaration of function ‘strlen’ [-Wimplicit-function-declaration]
   36 |                                         size_t len = strlen(s);
      |                                                      ^~~~~~
Main.c:3:1: note: include ‘<string.h>’ or provide a declaration of ‘strlen’
    2 | #include <stdlib.h>
  +++ |+#include <string.h>
    3 | 
Main.c:36:54: warning: incompatible implicit declaration of built-in function ‘strlen’ [-Wbuiltin-declaration-mismatch]
   36 |                                         size_t len = strlen(s);
      |                                                      ^~~~~~
Main.c:36:54: note: include ‘<string.h>’ or provide a declaration of ‘strlen’
Main.c:41:41: warning: implicit declaration of function ‘strcpy’ [-Wimplicit-function-declaration]
   41 |                                         strcpy(node->str, s);
      |                                         ^~~~~~
Main.c:41:41: note: include ‘<string.h>’ or provide a declaration of ‘strcpy’
Main.c:41:41: warning: incompatible implicit declaration of built-in function ‘strcpy’ [-Wbuiltin-declaration-mismatch]
Main.c:41:41: note: include ‘<string.h>’ or provide a declaration of ‘strcpy’

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 425 / 425
Status
AC × 3
AC × 49
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 02_random2_00.txt, 02_random2_01.txt, 02_random2_02.txt, 02_random2_03.txt, 02_random2_04.txt, 02_random2_05.txt, 02_random2_06.txt, 02_random2_07.txt, 02_random2_08.txt, 02_random2_09.txt, 02_random2_10.txt, 02_random2_11.txt, 02_random2_12.txt, 02_random2_13.txt, 02_random2_14.txt, 02_random2_15.txt, 03_random3_00.txt, 03_random3_01.txt, 03_random3_02.txt, 03_random3_03.txt, 04_random4_00.txt, 04_random4_01.txt, 05_random5_00.txt, 05_random5_01.txt, 06_handmade_00.txt, 06_handmade_01.txt, 06_handmade_02.txt, 06_handmade_03.txt, 06_handmade_04.txt, 06_handmade_05.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 1632 KiB
00_sample_01.txt AC 1 ms 1640 KiB
00_sample_02.txt AC 1 ms 1664 KiB
01_random_00.txt AC 4 ms 3644 KiB
01_random_01.txt AC 27 ms 5864 KiB
01_random_02.txt AC 25 ms 4688 KiB
01_random_03.txt AC 3 ms 3036 KiB
01_random_04.txt AC 27 ms 6312 KiB
01_random_05.txt AC 6 ms 2688 KiB
01_random_06.txt AC 4 ms 2988 KiB
01_random_07.txt AC 5 ms 2812 KiB
01_random_08.txt AC 25 ms 4948 KiB
01_random_09.txt AC 26 ms 5392 KiB
01_random_10.txt AC 20 ms 3792 KiB
01_random_11.txt AC 7 ms 2492 KiB
01_random_12.txt AC 20 ms 4752 KiB
01_random_13.txt AC 20 ms 4904 KiB
01_random_14.txt AC 25 ms 4940 KiB
01_random_15.txt AC 18 ms 4344 KiB
02_random2_00.txt AC 46 ms 9412 KiB
02_random2_01.txt AC 45 ms 9512 KiB
02_random2_02.txt AC 44 ms 9300 KiB
02_random2_03.txt AC 44 ms 9304 KiB
02_random2_04.txt AC 50 ms 10880 KiB
02_random2_05.txt AC 48 ms 9164 KiB
02_random2_06.txt AC 45 ms 8160 KiB
02_random2_07.txt AC 38 ms 6696 KiB
02_random2_08.txt AC 49 ms 14364 KiB
02_random2_09.txt AC 47 ms 9680 KiB
02_random2_10.txt AC 41 ms 7268 KiB
02_random2_11.txt AC 33 ms 4864 KiB
02_random2_12.txt AC 47 ms 16500 KiB
02_random2_13.txt AC 44 ms 10612 KiB
02_random2_14.txt AC 36 ms 6528 KiB
02_random2_15.txt AC 26 ms 3108 KiB
03_random3_00.txt AC 41 ms 9884 KiB
03_random3_01.txt AC 40 ms 9868 KiB
03_random3_02.txt AC 40 ms 9856 KiB
03_random3_03.txt AC 26 ms 8232 KiB
04_random4_00.txt AC 37 ms 9840 KiB
04_random4_01.txt AC 37 ms 9836 KiB
05_random5_00.txt AC 44 ms 18020 KiB
05_random5_01.txt AC 47 ms 17828 KiB
06_handmade_00.txt AC 1 ms 1548 KiB
06_handmade_01.txt AC 4 ms 3564 KiB
06_handmade_02.txt AC 29 ms 3116 KiB
06_handmade_03.txt AC 56 ms 15652 KiB
06_handmade_04.txt AC 22 ms 1588 KiB
06_handmade_05.txt AC 29 ms 9044 KiB


2025-07-03 (Thu)
02:52:37 +09:00