제출 #493277

#제출 시각아이디문제언어결과실행 시간메모리
493277rainboyCigle (COI21_cigle)C11
48 / 100
1091 ms67240 KiB
#include <stdio.h> #define N 5000 int max(int a, int b) { return a > b ? a : b; } int main() { static int aa[N + 1], dp[N + 1][N + 1]; int n, i, j, k, l, x, ans; scanf("%d", &n); for (i = 1; i <= n; i++) { scanf("%d", &aa[i]); aa[i] += aa[i - 1]; } for (i = 1; i <= n; i++) dp[0][i] = 0; for (i = 0; i <= n; i++) for (j = i + 1; j <= n; j++) for (k = j + 1, l = j - 1, x = dp[i][j]; k <= n; k++) { dp[j][k] = max(dp[j][k], x); while (l >= 0 && aa[k] + aa[l] > aa[j] * 2) l--; if (l > i && aa[k] + aa[l] == aa[j] * 2) x++; } ans = 0; for (i = 0; i < n; i++) ans = max(ans, dp[i][n]); printf("%d\n", ans); return 0; }

컴파일 시 표준 에러 (stderr) 메시지

cigle.c: In function 'main':
cigle.c:11:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |  scanf("%d", &n);
      |  ^~~~~~~~~~~~~~~
cigle.c:13:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |   scanf("%d", &aa[i]);
      |   ^~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...