# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1251517 | 3m17 | Hacker (BOI15_hac) | C++20 | 345 ms | 23900 KiB |
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define fi first
#define se second
#define int long long
const int Nmax = 5e5 + 174;
int n , a[Nmax];
int pre[Nmax * 2];
int Ans;
multiset <int> S;
main(){
cin >> n;
for (int i = 1 ; i <= n ; i++)
cin >> a[i];
for (int i = 1 ; i <= 2 * n ; i++)
pre[i] = pre[i - 1] + a[(i > n ? i % n : i)];
int k = n / 2 + (n % 2);
for (int i = 1 ; i <= 2 * n ; i++)
{
S.insert(pre[i + k - 1] - pre[i - 1]);
if(i >= k)
{
Ans = max(Ans , *S.begin());
S.erase(S.find(pre[i] - pre[i - k]));
}
}
cout << Ans;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |