답안 #696554

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
696554 2023-02-06T19:35:04 Z ParsaS Hacker (BOI15_hac) C++17
100 / 100
316 ms 21456 KB
// In the name of God
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
typedef long long ll;
const int N = 1e6 + 5;
int n, v[N], s[N];
void solve() {
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> v[i];
        v[i + n] = v[i];
    }
    int ans = 0;
    multiset<int> st;
    for (int i = 0; i < (n + 1) / 2; i++)
        s[(n + 1) / 2 - 1] += v[i];
    for (int i = (n + 1) / 2; i < 2 * n; i++) {
        s[i] = s[i - 1] - v[i - (n + 1) / 2] + v[i];
    }
    for (int i = (n + 1) / 2 - 1; i <= 2 * ((n + 1) / 2 - 1); i++) {
        st.insert(s[i]);
    }
    ans = *st.begin();
    for (int i = (n + 1) / 2; i + (n + 1) / 2 - 1 < 2 * n; i++) {
        st.erase(st.find(s[i - 1]));
        st.insert(s[i + (n + 1) / 2 - 1]);
        ans = max(ans, *st.begin());
    }
    cout << ans << '\n';
}
int32_t main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    solve();
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 328 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 328 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 324 KB Output is correct
15 Correct 0 ms 320 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 328 KB Output is correct
18 Correct 0 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 328 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 328 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 324 KB Output is correct
15 Correct 0 ms 320 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 328 KB Output is correct
18 Correct 0 ms 340 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 328 KB Output is correct
22 Correct 1 ms 468 KB Output is correct
23 Correct 2 ms 556 KB Output is correct
24 Correct 1 ms 468 KB Output is correct
25 Correct 2 ms 468 KB Output is correct
26 Correct 2 ms 508 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 0 ms 320 KB Output is correct
30 Correct 2 ms 468 KB Output is correct
31 Correct 2 ms 468 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 2 ms 468 KB Output is correct
4 Correct 28 ms 3656 KB Output is correct
5 Correct 83 ms 8488 KB Output is correct
6 Correct 121 ms 10716 KB Output is correct
7 Correct 128 ms 12748 KB Output is correct
8 Correct 316 ms 21072 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 328 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 328 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 324 KB Output is correct
15 Correct 0 ms 320 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 328 KB Output is correct
18 Correct 0 ms 340 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 328 KB Output is correct
22 Correct 1 ms 468 KB Output is correct
23 Correct 2 ms 556 KB Output is correct
24 Correct 1 ms 468 KB Output is correct
25 Correct 2 ms 468 KB Output is correct
26 Correct 2 ms 508 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 0 ms 320 KB Output is correct
30 Correct 2 ms 468 KB Output is correct
31 Correct 2 ms 468 KB Output is correct
32 Correct 0 ms 340 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 2 ms 468 KB Output is correct
35 Correct 28 ms 3656 KB Output is correct
36 Correct 83 ms 8488 KB Output is correct
37 Correct 121 ms 10716 KB Output is correct
38 Correct 128 ms 12748 KB Output is correct
39 Correct 316 ms 21072 KB Output is correct
40 Correct 4 ms 724 KB Output is correct
41 Correct 7 ms 1104 KB Output is correct
42 Correct 11 ms 1568 KB Output is correct
43 Correct 84 ms 8624 KB Output is correct
44 Correct 258 ms 21076 KB Output is correct
45 Correct 39 ms 4396 KB Output is correct
46 Correct 126 ms 12664 KB Output is correct
47 Correct 276 ms 21072 KB Output is correct
48 Correct 224 ms 21456 KB Output is correct
49 Correct 200 ms 20540 KB Output is correct
50 Correct 200 ms 20412 KB Output is correct