Submission #1023118

#TimeUsernameProblemLanguageResultExecution timeMemory
1023118AlmontherHacker (BOI15_hac)C++98
0 / 100
1 ms2396 KiB
#include <bits/stdc++.h> #define suiii ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define ll long long #define co cout<< //#pragma GCC optimize("O3,Ofast,unroll-loops") //#pragma GCC target("avx2,sse3,sse4,avx") using namespace std; //stuff ll n; ll arr[1000001]; ll precal[1000001]; set<pair<ll,ll>>s; ll sum=0; void solve(){ cin>>n; for(int i=1;i<=n;i++){ cin>>arr[i]; sum+=arr[i]; } for(int i=1;i<=n/2;i++){ precal[1]+=arr[i]; } s.insert({precal[1],1}); for(int i=2,j=n/2+1;max(i,j)<=n;i++,j++){ precal[i]=precal[i-1]+arr[j]-arr[i-1]; s.insert({precal[i],i}); } for(int j=1,i=n/2+2;max(i,j)<=n;i++,j++){ precal[i]=precal[i-1]+arr[j]-arr[i-1]; s.insert({precal[i],i}); } ll mx=-1; for(int i=1;i<=n;i++){ auto it=s.rbegin(); if((*it).second==i) it++; mx=max(mx,sum-(*it).first); } co mx; } int main() { suiii int tt=1; // cin>>tt; while(tt--){ solve(); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...