답안 #983900

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
983900 2024-05-16T07:49:41 Z LucaIlie Hacker (BOI15_hac) C++17
100 / 100
275 ms 18520 KB
#include <bits/stdc++.h>

using namespace std;

const int MAX_N = 5e5;
int n, v[MAX_N + 1], sp[MAX_N + 1];

int sum( int l, int r ) {
    if ( l > n )
        l -= n;
    if ( r > n )
        r -= n;

    if ( l > r )
        return sp[n] - sp[l  - 1] + sp[r];
    return sp[r] - sp[l - 1];
}

int main() {
    cin >> n;
    for ( int i = 1; i <= n; i++ ) {
        cin >> v[i];
        sp[i] = sp[i - 1] + v[i];
    }

    int maxx = 0;
    multiset<int> minn;
    for ( int l = 0; l < (n + 1) / 2; l++ )
        minn.insert( sum( 1 + l, 1 + l + (n + 1) / 2 - 1 ) );
    for ( int i = 1; i <= n; i++ ) {
        maxx = max( maxx, *minn.begin() );
        int sin = sum( i + (n + 1) / 2, i + (n + 1) / 2 + (n + 1) / 2 - 1 );
        int sout = sum( i, i + (n + 1) / 2 - 1 );
        minn.insert( sin );
        minn.erase( minn.lower_bound( sout ) );
    }

    cout << maxx;

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2492 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2392 KB Output is correct
11 Correct 1 ms 2392 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 0 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2552 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 1 ms 2392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2492 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2392 KB Output is correct
11 Correct 1 ms 2392 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 0 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2552 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 1 ms 2392 KB Output is correct
19 Correct 1 ms 2648 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
22 Correct 2 ms 2396 KB Output is correct
23 Correct 2 ms 2396 KB Output is correct
24 Correct 1 ms 2396 KB Output is correct
25 Correct 2 ms 2392 KB Output is correct
26 Correct 2 ms 2396 KB Output is correct
27 Correct 1 ms 2396 KB Output is correct
28 Correct 1 ms 2396 KB Output is correct
29 Correct 1 ms 2396 KB Output is correct
30 Correct 2 ms 2396 KB Output is correct
31 Correct 2 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 2 ms 2396 KB Output is correct
4 Correct 32 ms 4596 KB Output is correct
5 Correct 91 ms 8404 KB Output is correct
6 Correct 121 ms 10324 KB Output is correct
7 Correct 147 ms 11964 KB Output is correct
8 Correct 275 ms 18016 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2492 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2392 KB Output is correct
11 Correct 1 ms 2392 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 0 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2552 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 1 ms 2392 KB Output is correct
19 Correct 1 ms 2648 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
22 Correct 2 ms 2396 KB Output is correct
23 Correct 2 ms 2396 KB Output is correct
24 Correct 1 ms 2396 KB Output is correct
25 Correct 2 ms 2392 KB Output is correct
26 Correct 2 ms 2396 KB Output is correct
27 Correct 1 ms 2396 KB Output is correct
28 Correct 1 ms 2396 KB Output is correct
29 Correct 1 ms 2396 KB Output is correct
30 Correct 2 ms 2396 KB Output is correct
31 Correct 2 ms 2396 KB Output is correct
32 Correct 1 ms 2396 KB Output is correct
33 Correct 1 ms 2396 KB Output is correct
34 Correct 2 ms 2396 KB Output is correct
35 Correct 32 ms 4596 KB Output is correct
36 Correct 91 ms 8404 KB Output is correct
37 Correct 121 ms 10324 KB Output is correct
38 Correct 147 ms 11964 KB Output is correct
39 Correct 275 ms 18016 KB Output is correct
40 Correct 4 ms 2652 KB Output is correct
41 Correct 9 ms 3032 KB Output is correct
42 Correct 13 ms 3420 KB Output is correct
43 Correct 93 ms 8528 KB Output is correct
44 Correct 256 ms 18068 KB Output is correct
45 Correct 41 ms 5468 KB Output is correct
46 Correct 156 ms 11824 KB Output is correct
47 Correct 271 ms 18248 KB Output is correct
48 Correct 227 ms 18520 KB Output is correct
49 Correct 204 ms 17656 KB Output is correct
50 Correct 197 ms 17492 KB Output is correct