Submission #31576

#TimeUsernameProblemLanguageResultExecution timeMemory
31576huynd2001Hacker (BOI15_hac)C++14
0 / 100
0 ms9828 KiB
/*huypheu 5 1 1 1 1 1 */ #include <bits/stdc++.h> #define int long long using namespace std; int a[500007]; int su[500007]; signed main() { int n; scanf("%lld",&n); for(int i=1;i<=n;i++) { scanf("%lld",&a[i]); } int la=(n/2)+1; for(int i=1;i<=n;i++) { su[i]=su[i-1]+a[i]; } int mi=su[n]; for(int i=2;i<=n-la+1;i++) { mi=min(mi,su[i+la-1]-su[i-1]); } printf("%lld\n",mi); return 0; }

Compilation message (stderr)

hac.cpp: In function 'int main()':
hac.cpp:16:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld",&n);
                  ^
hac.cpp:19:22: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld",&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...