답안 #32318

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
32318 2017-10-08T14:37:27 Z dqhungdl Hacker (BOI15_hac) C++14
100 / 100
743 ms 17672 KB
#include <bits/stdc++.h>
using namespace std;

int n,sum=0,res=0,a[1000005];
multiset<int> s;

int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        a[i+n]=a[i];
        sum+=a[i];
    }
    for(int i=1;i<=2*n;i++)
        a[i]+=a[i-1];
    int k=n/2;
    for(int i=k;i<n;i++)
        s.insert(a[i]-a[i-k]);
    for(int i=1;i<=n;i++)
    {
        s.erase(s.find(a[i+k-1]-a[i-1]));
        s.insert(a[i+n-1]-a[i+n-1-k]);
        res=max(res,sum-*s.rbegin());
    }
    cout<<res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 5924 KB Output is correct
2 Correct 0 ms 5924 KB Output is correct
3 Correct 0 ms 5924 KB Output is correct
4 Correct 0 ms 5924 KB Output is correct
5 Correct 0 ms 5924 KB Output is correct
6 Correct 0 ms 5924 KB Output is correct
7 Correct 0 ms 5924 KB Output is correct
8 Correct 0 ms 5924 KB Output is correct
9 Correct 0 ms 5924 KB Output is correct
10 Correct 0 ms 5924 KB Output is correct
11 Correct 0 ms 5924 KB Output is correct
12 Correct 0 ms 5924 KB Output is correct
13 Correct 0 ms 5924 KB Output is correct
14 Correct 0 ms 5924 KB Output is correct
15 Correct 0 ms 5924 KB Output is correct
16 Correct 0 ms 5924 KB Output is correct
17 Correct 0 ms 5924 KB Output is correct
18 Correct 0 ms 5924 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 5924 KB Output is correct
2 Correct 0 ms 5924 KB Output is correct
3 Correct 0 ms 5924 KB Output is correct
4 Correct 0 ms 5924 KB Output is correct
5 Correct 0 ms 5924 KB Output is correct
6 Correct 0 ms 5924 KB Output is correct
7 Correct 0 ms 5924 KB Output is correct
8 Correct 0 ms 5924 KB Output is correct
9 Correct 0 ms 5924 KB Output is correct
10 Correct 0 ms 5924 KB Output is correct
11 Correct 0 ms 5924 KB Output is correct
12 Correct 0 ms 5924 KB Output is correct
13 Correct 0 ms 5924 KB Output is correct
14 Correct 0 ms 5924 KB Output is correct
15 Correct 0 ms 5924 KB Output is correct
16 Correct 0 ms 5924 KB Output is correct
17 Correct 0 ms 5924 KB Output is correct
18 Correct 0 ms 5924 KB Output is correct
19 Correct 0 ms 5924 KB Output is correct
20 Correct 0 ms 5924 KB Output is correct
21 Correct 0 ms 5924 KB Output is correct
22 Correct 0 ms 6056 KB Output is correct
23 Correct 3 ms 6056 KB Output is correct
24 Correct 3 ms 6056 KB Output is correct
25 Correct 3 ms 6056 KB Output is correct
26 Correct 3 ms 6056 KB Output is correct
27 Correct 0 ms 5924 KB Output is correct
28 Correct 0 ms 5924 KB Output is correct
29 Correct 0 ms 5924 KB Output is correct
30 Correct 3 ms 6056 KB Output is correct
31 Correct 3 ms 6056 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 5924 KB Output is correct
2 Correct 0 ms 5924 KB Output is correct
3 Correct 3 ms 6056 KB Output is correct
4 Correct 59 ms 7772 KB Output is correct
5 Correct 243 ms 10676 KB Output is correct
6 Correct 356 ms 11864 KB Output is correct
7 Correct 339 ms 12920 KB Output is correct
8 Correct 743 ms 17672 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 5924 KB Output is correct
2 Correct 0 ms 5924 KB Output is correct
3 Correct 0 ms 5924 KB Output is correct
4 Correct 0 ms 5924 KB Output is correct
5 Correct 0 ms 5924 KB Output is correct
6 Correct 0 ms 5924 KB Output is correct
7 Correct 0 ms 5924 KB Output is correct
8 Correct 0 ms 5924 KB Output is correct
9 Correct 0 ms 5924 KB Output is correct
10 Correct 0 ms 5924 KB Output is correct
11 Correct 0 ms 5924 KB Output is correct
12 Correct 0 ms 5924 KB Output is correct
13 Correct 0 ms 5924 KB Output is correct
14 Correct 0 ms 5924 KB Output is correct
15 Correct 0 ms 5924 KB Output is correct
16 Correct 0 ms 5924 KB Output is correct
17 Correct 0 ms 5924 KB Output is correct
18 Correct 0 ms 5924 KB Output is correct
19 Correct 0 ms 5924 KB Output is correct
20 Correct 0 ms 5924 KB Output is correct
21 Correct 0 ms 5924 KB Output is correct
22 Correct 0 ms 6056 KB Output is correct
23 Correct 3 ms 6056 KB Output is correct
24 Correct 3 ms 6056 KB Output is correct
25 Correct 3 ms 6056 KB Output is correct
26 Correct 3 ms 6056 KB Output is correct
27 Correct 0 ms 5924 KB Output is correct
28 Correct 0 ms 5924 KB Output is correct
29 Correct 0 ms 5924 KB Output is correct
30 Correct 3 ms 6056 KB Output is correct
31 Correct 3 ms 6056 KB Output is correct
32 Correct 0 ms 5924 KB Output is correct
33 Correct 0 ms 5924 KB Output is correct
34 Correct 3 ms 6056 KB Output is correct
35 Correct 59 ms 7772 KB Output is correct
36 Correct 243 ms 10676 KB Output is correct
37 Correct 356 ms 11864 KB Output is correct
38 Correct 339 ms 12920 KB Output is correct
39 Correct 743 ms 17672 KB Output is correct
40 Correct 6 ms 6188 KB Output is correct
41 Correct 16 ms 6452 KB Output is correct
42 Correct 23 ms 6584 KB Output is correct
43 Correct 243 ms 10676 KB Output is correct
44 Correct 579 ms 17672 KB Output is correct
45 Correct 76 ms 8300 KB Output is correct
46 Correct 309 ms 12920 KB Output is correct
47 Correct 693 ms 17672 KB Output is correct
48 Correct 463 ms 17672 KB Output is correct
49 Correct 406 ms 17672 KB Output is correct
50 Correct 383 ms 17672 KB Output is correct