Submission #64483484


Source Code Expand

Copy
#include <stdio.h>
int N;
int A[312345];
int cnt[2][312345];
int main(void) {
int i;
int cur = 0, ans = 0;
if (scanf("%d", &N) != 1) return 1;
for (i = 0; i < N; i++) {
if (scanf("%d", &A[i]) != 1) return 1;
if (cnt[0][A[i]]++ == 0) cur++;
}
for (i = 0; i < N - 1; i++) {
if (--cnt[0][A[i]] == 0) cur--;
if (cnt[1][A[i]]++ == 0) cur++;
if (ans < cur) ans = cur;
}
printf("%d\n", ans);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include <stdio.h>

int N;
int A[312345];

int cnt[2][312345];

int main(void) {
	int i;
	int cur = 0, ans = 0;
	if (scanf("%d", &N) != 1) return 1;
	for (i = 0; i < N; i++) {
		if (scanf("%d", &A[i]) != 1) return 1;
		if (cnt[0][A[i]]++ == 0) cur++;
	}
	for (i = 0; i < N - 1; i++) {
		if (--cnt[0][A[i]] == 0) cur--;
		if (cnt[1][A[i]]++ == 0) cur++;
		if (ans < cur) ans = cur;
	}
	printf("%d\n", ans);
	return 0;
}

Submission Info

Submission Time
Task C - Variety Split Easy
User mikecat
Language C (gcc 12.2.0)
Score 350
Code Size 442 Byte
Status AC
Exec Time 34 ms
Memory 5248 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 350 / 350
Status
AC × 2
AC × 38
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt
All 00_sample_00.txt, 00_sample_01.txt, 01_test_00.txt, 01_test_01.txt, 01_test_02.txt, 01_test_03.txt, 01_test_04.txt, 01_test_05.txt, 01_test_06.txt, 01_test_07.txt, 01_test_08.txt, 01_test_09.txt, 01_test_10.txt, 01_test_11.txt, 01_test_12.txt, 01_test_13.txt, 01_test_14.txt, 01_test_15.txt, 01_test_16.txt, 01_test_17.txt, 01_test_18.txt, 01_test_19.txt, 01_test_20.txt, 01_test_21.txt, 01_test_22.txt, 01_test_23.txt, 01_test_24.txt, 01_test_25.txt, 01_test_26.txt, 01_test_27.txt, 01_test_28.txt, 01_test_29.txt, 01_test_30.txt, 01_test_31.txt, 01_test_32.txt, 01_test_33.txt, 01_test_34.txt, 01_test_35.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 1656 KB
00_sample_01.txt AC 1 ms 1736 KB
01_test_00.txt AC 1 ms 1588 KB
01_test_01.txt AC 1 ms 1724 KB
01_test_02.txt AC 1 ms 1644 KB
01_test_03.txt AC 1 ms 1724 KB
01_test_04.txt AC 1 ms 1604 KB
01_test_05.txt AC 7 ms 2700 KB
01_test_06.txt AC 31 ms 5104 KB
01_test_07.txt AC 10 ms 2832 KB
01_test_08.txt AC 31 ms 5228 KB
01_test_09.txt AC 27 ms 4852 KB
01_test_10.txt AC 31 ms 5144 KB
01_test_11.txt AC 7 ms 2636 KB
01_test_12.txt AC 30 ms 5236 KB
01_test_13.txt AC 4 ms 2176 KB
01_test_14.txt AC 33 ms 5148 KB
01_test_15.txt AC 32 ms 5096 KB
01_test_16.txt AC 31 ms 5244 KB
01_test_17.txt AC 32 ms 5148 KB
01_test_18.txt AC 34 ms 5248 KB
01_test_19.txt AC 32 ms 5168 KB
01_test_20.txt AC 15 ms 2816 KB
01_test_21.txt AC 20 ms 2808 KB
01_test_22.txt AC 19 ms 2756 KB
01_test_23.txt AC 19 ms 2812 KB
01_test_24.txt AC 19 ms 2924 KB
01_test_25.txt AC 20 ms 5120 KB
01_test_26.txt AC 31 ms 5248 KB
01_test_27.txt AC 1 ms 1740 KB
01_test_28.txt AC 0 ms 1576 KB
01_test_29.txt AC 21 ms 5144 KB
01_test_30.txt AC 18 ms 3132 KB
01_test_31.txt AC 17 ms 2892 KB
01_test_32.txt AC 20 ms 5248 KB
01_test_33.txt AC 22 ms 5248 KB
01_test_34.txt AC 20 ms 5104 KB
01_test_35.txt AC 21 ms 5168 KB


2025-04-05 (Sat)
06:52:38 +09:00