| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 479396 | rainboy | Sličice (COCI19_slicice) | C11 | 164 ms | 324 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <stdio.h>
#include <string.h>
#define N	500
#define M	500
#define K	500
int max(int a, int b) { return a > b ? a : b; }
int main() {
	static int aa[N], bb[M + 1], dp[K + 1];
	int n, m, k, i, j, s, c;
	scanf("%d%d%d", &n, &m, &k);
	for (i = 0; i < n; i++)
		scanf("%d", &aa[i]);
	for (j = 0; j <= m; j++)
		scanf("%d", &bb[j]);
	memset(dp, -1, (k + 1) * sizeof *dp), dp[0] = 0;
	for (i = 0; i < n; i++)
		for (s = k; s >= 0; s--)
			for (c = 0; aa[i] + c <= m && c <= s; c++)
				if (dp[s - c] != -1)
					dp[s] = max(dp[s], dp[s - c] + bb[aa[i] + c]);
	printf("%d\n", dp[k]);
	return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
