Submission #732077

#TimeUsernameProblemLanguageResultExecution timeMemory
732077sleepntsheepHacker (BOI15_hac)C++17
0 / 100
1 ms308 KiB
#include <bits/stdc++.h> using namespace std; #define N 500005 int n, a[N], b[N]; using ll = long long; ll ring_query2(int l, int r) { if (l > 0 && r <= n) return b[r] - b[l-1]; if (r > 0 && l <= 0) return ring_query2(1, r) + ring_query2(l + n, n); if (l > 0 && l <= n && r > n) return ring_query2(l, n) + ring_query2(1, r - n); printf("%d %d\n", l, r); assert(0); } ll z = 0; ll ring_query(int l, int r) { ll res = ring_query2(l, r); return res; } int main() { scanf("%d", &n); for (int i = 1; i <= n; i++) scanf("%d", a+i), b[i] = b[i-1] + a[i]; int bsz = n % 2 ? (n + 1) / 2 : n / 2; for (int i = 1; i <= n; i++) z = max(z, min(ring_query(i - bsz + 1, i), ring_query(i, i + bsz - 1))); printf("%lld", z); return 0; }

Compilation message (stderr)

hac.cpp: In function 'int main()':
hac.cpp:25:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
hac.cpp:26:39: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   26 |     for (int i = 1; i <= n; i++) scanf("%d", a+i), b[i] = b[i-1] + a[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...