Submission #1565977


Source Code Expand

#include<stdio.h>

int main()
{
	int n, i, j, max, min, cnt;
	int *c;

	scanf("%d", &n);

	max = 0;
	min = n;

	c = (int *)calloc(n, sizeof(int));

	while(getchar() != '\n')
		;

	for(i = 0; i < n; i++)
		c[i] = getchar();
	
	for(i = 0; i < 4; i++)
	{
		cnt = 0;

		for(j = 0; j < n; j++)
			if(i + 1 == c[j] - '0')
				cnt++;

		if(cnt > max)
			max = cnt;
		
		if(cnt < min)
			min = cnt;
	}

	printf("%d %d\n", max, min);

	free(c);

	return 0;
}

Submission Info

Submission Time
Task A - センター採点
User mafun
Language C (GCC 5.4.1)
Score 100
Code Size 489 Byte
Status AC
Exec Time 1 ms
Memory 128 KB

Compile Error

./Main.c: In function ‘main’:
./Main.c:13:13: warning: implicit declaration of function ‘calloc’ [-Wimplicit-function-declaration]
  c = (int *)calloc(n, sizeof(int));
             ^
./Main.c:13:13: warning: incompatible implicit declaration of built-in function ‘calloc’
./Main.c:13:13: note: include ‘<stdlib.h>’ or provide a declaration of ‘calloc’
./Main.c:38:2: warning: implicit declaration of function ‘free’ [-Wimplicit-function-declaration]
  free(c);
  ^
./Main.c:38:2: warning: incompatible implicit declaration of built-in function ‘free’
./Main.c:38:2: note: include ‘<stdlib.h>’ or provide a declaration of ‘free’
./Main.c:8:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
  ^

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 30
Set Name Test Cases
All 00_sample1.txt, 00_sample2.txt, 01_rnd_00.txt, 01_rnd_01.txt, 01_rnd_02.txt, 01_rnd_03.txt, 01_rnd_04.txt, 01_rnd_05.txt, 01_rnd_06.txt, 01_rnd_07.txt, 01_rnd_08.txt, 01_rnd_09.txt, 01_rnd_10.txt, 01_rnd_11.txt, 01_rnd_12.txt, 01_rnd_13.txt, 01_rnd_14.txt, 01_rnd_15.txt, 01_rnd_16.txt, 01_rnd_17.txt, 01_rnd_18.txt, 01_rnd_19.txt, 02_all_1.txt, 02_all_2.txt, 02_all_3.txt, 02_all_4.txt, 03_mini_1.txt, 03_mini_2.txt, 03_mini_3.txt, 03_mini_4.txt
Case Name Status Exec Time Memory
00_sample1.txt AC 1 ms 128 KB
00_sample2.txt AC 1 ms 128 KB
01_rnd_00.txt AC 1 ms 128 KB
01_rnd_01.txt AC 1 ms 128 KB
01_rnd_02.txt AC 1 ms 128 KB
01_rnd_03.txt AC 1 ms 128 KB
01_rnd_04.txt AC 1 ms 128 KB
01_rnd_05.txt AC 1 ms 128 KB
01_rnd_06.txt AC 1 ms 128 KB
01_rnd_07.txt AC 1 ms 128 KB
01_rnd_08.txt AC 1 ms 128 KB
01_rnd_09.txt AC 1 ms 128 KB
01_rnd_10.txt AC 1 ms 128 KB
01_rnd_11.txt AC 1 ms 128 KB
01_rnd_12.txt AC 1 ms 128 KB
01_rnd_13.txt AC 1 ms 128 KB
01_rnd_14.txt AC 1 ms 128 KB
01_rnd_15.txt AC 1 ms 128 KB
01_rnd_16.txt AC 1 ms 128 KB
01_rnd_17.txt AC 1 ms 128 KB
01_rnd_18.txt AC 1 ms 128 KB
01_rnd_19.txt AC 1 ms 128 KB
02_all_1.txt AC 1 ms 128 KB
02_all_2.txt AC 1 ms 128 KB
02_all_3.txt AC 1 ms 128 KB
02_all_4.txt AC 1 ms 128 KB
03_mini_1.txt AC 1 ms 128 KB
03_mini_2.txt AC 1 ms 128 KB
03_mini_3.txt AC 1 ms 128 KB
03_mini_4.txt AC 1 ms 128 KB