답안 #311286

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
311286 2020-10-09T20:55:10 Z sofapuden Hacker (BOI15_hac) C++14
100 / 100
617 ms 17640 KB
#include <bits/stdc++.h>

using namespace std;

int main(){
    int n; cin >> n;
    vector<int> v(n), msa;
    for(auto &x : v)cin >> x;
    int cur = 0;
    for(int i = 0; i < (n+1)/2; ++i){
        cur+=v[i];
    }
    msa.push_back(cur);
    for(int i = 0; i < n-1; ++i){
        cur-=v[i];
        cur+=v[(i+((n+1)/2))%n];
        msa.push_back(cur);
    }
    map<int,int> S;
    for(int i = 0; i < (n+1)/2; ++i){
        S[msa[i]]++;
    }
    int ans = S.begin()->first;
    for(int i = 0; i < n-1; ++i){
        S[msa[i]]--;
        if(!S[msa[i]])S.erase(msa[i]);
        S[msa[(i+((n+1)/2))%n]]++;
        ans = max(ans,S.begin()->first);
    }
    cout << ans << "\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 0 ms 256 KB Output is correct
14 Correct 1 ms 256 KB Output is correct
15 Correct 0 ms 256 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 1 ms 384 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 0 ms 256 KB Output is correct
14 Correct 1 ms 256 KB Output is correct
15 Correct 0 ms 256 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 1 ms 384 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 3 ms 384 KB Output is correct
23 Correct 5 ms 512 KB Output is correct
24 Correct 3 ms 384 KB Output is correct
25 Correct 5 ms 512 KB Output is correct
26 Correct 5 ms 512 KB Output is correct
27 Correct 0 ms 256 KB Output is correct
28 Correct 1 ms 256 KB Output is correct
29 Correct 0 ms 256 KB Output is correct
30 Correct 4 ms 512 KB Output is correct
31 Correct 4 ms 512 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 5 ms 512 KB Output is correct
4 Correct 83 ms 2932 KB Output is correct
5 Correct 214 ms 5100 KB Output is correct
6 Correct 289 ms 7276 KB Output is correct
7 Correct 344 ms 8748 KB Output is correct
8 Correct 617 ms 13184 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 0 ms 256 KB Output is correct
14 Correct 1 ms 256 KB Output is correct
15 Correct 0 ms 256 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 1 ms 384 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 3 ms 384 KB Output is correct
23 Correct 5 ms 512 KB Output is correct
24 Correct 3 ms 384 KB Output is correct
25 Correct 5 ms 512 KB Output is correct
26 Correct 5 ms 512 KB Output is correct
27 Correct 0 ms 256 KB Output is correct
28 Correct 1 ms 256 KB Output is correct
29 Correct 0 ms 256 KB Output is correct
30 Correct 4 ms 512 KB Output is correct
31 Correct 4 ms 512 KB Output is correct
32 Correct 1 ms 256 KB Output is correct
33 Correct 1 ms 384 KB Output is correct
34 Correct 5 ms 512 KB Output is correct
35 Correct 83 ms 2932 KB Output is correct
36 Correct 214 ms 5100 KB Output is correct
37 Correct 289 ms 7276 KB Output is correct
38 Correct 344 ms 8748 KB Output is correct
39 Correct 617 ms 13184 KB Output is correct
40 Correct 11 ms 640 KB Output is correct
41 Correct 20 ms 896 KB Output is correct
42 Correct 31 ms 1312 KB Output is correct
43 Correct 225 ms 6636 KB Output is correct
44 Correct 592 ms 15976 KB Output is correct
45 Correct 80 ms 2544 KB Output is correct
46 Correct 340 ms 10088 KB Output is correct
47 Correct 615 ms 15096 KB Output is correct
48 Correct 254 ms 7020 KB Output is correct
49 Correct 433 ms 17640 KB Output is correct
50 Correct 438 ms 17536 KB Output is correct