Submission #532301

#TimeUsernameProblemLanguageResultExecution timeMemory
532301rainboy도넛 (JOI14_ho_t3)C11
50 / 100
264 ms712 KiB
#include <stdio.h> #define N 8000 long long min(long long a, long long b) { return a < b ? a : b; } long long max(long long a, long long b) { return a > b ? a : b; } int main() { static long long aa[N + 1]; int n, i, j, k; long long ans; scanf("%d", &n); for (i = 1; i <= n; i++) { scanf("%lld", &aa[i]); aa[i] += aa[i - 1]; } ans = 0; for (i = 0; i < n; i++) for (j = i + 1, k = i + 1; k < n; k++) { while (j < n && aa[j] - aa[i] < aa[k] - aa[j]) j++; ans = max(ans, min(max(aa[j - 1] - aa[i], aa[k] - aa[j]), aa[n] + aa[i] - aa[k])); } printf("%lld\n", ans); return 0; }

Compilation message (stderr)

2014_ho_t3.c: In function 'main':
2014_ho_t3.c:13:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |  scanf("%d", &n);
      |  ^~~~~~~~~~~~~~~
2014_ho_t3.c:15:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |   scanf("%lld", &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...