Submission #949159

# Submission time Handle Problem Language Result Execution time Memory
949159 2024-03-19T03:06:39 Z Muhammad_Aneeq Hacker (BOI15_hac) C++17
0 / 100
0 ms 348 KB
/*
بسم الله الرحمن الرحيم
Author:
                          (:Muhammad Aneeq:)
*/

#include <iostream>
using namespace std;
inline void solve()
{
    int n;
    cin>>n;
    int a[n];
    for (auto& i:a)
        cin>>i;
    int pre[n+1]={};
    for (int i=0;i<n;i++)
        pre[i+1]=pre[i]+a[i];
    int ans=0;
    for (int i=1;i<=n;i++)
        ans=max(ans,a[i-1]+min(pre[i-1],pre[n]-pre[i]));
    cout<<ans<<endl;
}
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
        solve();
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -