제출 #1270598

#제출 시각아이디문제언어결과실행 시간메모리
1270598tryharderforioi100Hacker (BOI15_hac)C++17
0 / 100
0 ms324 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define endl "\n" int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ll t=1; //cin>>t; while(t--) { ll n; cin>>n; ll a[2*n+1],i,pf[2*n+1]; a[0]=0; pf[0]=0; for(i=1;i<=n;i++) { cin>>a[i]; a[i+n]=a[i]; } for(i=1;i<=2*n;i++) { pf[i]=pf[i-1]+a[i]; } ll val=0; ll len=n/2; for(i=len;i<=2*n;i++) { val=max(val,pf[i]-pf[i-len]); } cout<<pf[n]-val<<endl; } #ifndef ONLINE_JUDGE cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"; #endif return 0; } // Author: tryharderforioi100
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...