Submission #74536399


Source Code Expand

Copy
#include <stdio.h>
int H, W, N;
int A[4096][4096];
int B[114514];
char aru[114514];
int main(void) {
int i, j;
int ans = 0;
if (scanf("%d%d%d", &H, &W, &N) != 3) return 1;
for (i = 0; i < H; i++) {
for (j = 0; j < W; j++) {
if (scanf("%d", &A[i][j]) != 1) return 1;
}
}
for (i = 0; i < N; i++) {
if (scanf("%d", &B[i]) != 1) return 1;
aru[B[i]] = 1;
}
for (i = 0; i < H; i++) {
int score = 0;
for (j = 0; j < W; j++) {
score += aru[A[i][j]];
}
if (score > ans) ans = score;
}
printf("%d\n", ans);
return 0;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include <stdio.h>

int H, W, N;
int A[4096][4096];
int B[114514];

char aru[114514];

int main(void) {
	int i, j;
	int ans = 0;
	if (scanf("%d%d%d", &H, &W, &N) != 3) return 1;
	for (i = 0; i < H; i++) {
		for (j = 0; j < W; j++) {
			if (scanf("%d", &A[i][j]) != 1) return 1;
		}
	}
	for (i = 0; i < N; i++) {
		if (scanf("%d", &B[i]) != 1) return 1;
		aru[B[i]] = 1;
	}
	for (i = 0; i < H; i++) {
		int score = 0;
		for (j = 0; j < W; j++) {
			score += aru[A[i][j]];
		}
		if (score > ans) ans = score;
	}
	printf("%d\n", ans);
	return 0;
}

Submission Info

Submission Time
Task B - Tombola
User mikecat
Language C23 (GCC 14.2.0)
Score 200
Code Size 576 Byte
Status AC
Exec Time 0 ms
Memory 1812 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 20
Set Name Test Cases
Sample 00-sample-01.txt, 00-sample-02.txt, 00-sample-03.txt
All 00-sample-01.txt, 00-sample-02.txt, 00-sample-03.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt
Case Name Status Exec Time Memory
00-sample-01.txt AC 0 ms 1636 KiB
00-sample-02.txt AC 0 ms 1740 KiB
00-sample-03.txt AC 0 ms 1812 KiB
01-01.txt AC 0 ms 1684 KiB
01-02.txt AC 0 ms 1740 KiB
01-03.txt AC 0 ms 1660 KiB
01-04.txt AC 0 ms 1740 KiB
01-05.txt AC 0 ms 1660 KiB
01-06.txt AC 0 ms 1680 KiB
01-07.txt AC 0 ms 1672 KiB
01-08.txt AC 0 ms 1748 KiB
01-09.txt AC 0 ms 1684 KiB
01-10.txt AC 0 ms 1808 KiB
01-11.txt AC 0 ms 1788 KiB
01-12.txt AC 0 ms 1700 KiB
01-13.txt AC 0 ms 1628 KiB
01-14.txt AC 0 ms 1672 KiB
01-15.txt AC 0 ms 1764 KiB
01-16.txt AC 0 ms 1808 KiB
01-17.txt AC 0 ms 1760 KiB


2026-03-30 (Mon)
09:26:07 +09:00