Submission #941398

# Submission time Handle Problem Language Result Execution time Memory
941398 2024-03-08T17:39:00 Z Darren0724 Hacker (BOI15_hac) C++17
100 / 100
227 ms 24192 KB
#include <bits/stdc++.h>
using namespace std;
#define LCBorz ios_base::sync_with_stdio(false); cin.tie(0);
#define all(x) x.begin(), x.end()
#define endl '\n'
const int N=200005;
const int INF=1e9;
int32_t main() {
    LCBorz;
    int n;cin>>n;
    vector<int> v(n*2+1),pre(n*2+1);
    for(int i=1;i<=n;i++){
        cin>>v[i];
        v[i+n]=v[i];
    }
    for(int i=1;i<=n*2;i++){
        pre[i]=pre[i-1]+v[i];
    }
    int ans=0;
    int p=(n+1)/2;
    vector<int> r;
    for(int i=0;i<n;i++){
        r.push_back(pre[i+p]-pre[i]);
    }
    multiset<int> m;
    for(int i=0;i<p-1;i++){
        m.insert(r[i]);
    }
    for(int i=0;i<n;i++){
        m.insert(r[(i+p-1)%n]);
        ans=max(ans,*m.begin());
        m.erase(m.find(r[i]));
    }
    cout<<ans<<endl;

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 604 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 604 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 468 KB Output is correct
23 Correct 2 ms 604 KB Output is correct
24 Correct 2 ms 348 KB Output is correct
25 Correct 2 ms 604 KB Output is correct
26 Correct 2 ms 600 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 344 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 1 ms 604 KB Output is correct
31 Correct 2 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 2 ms 604 KB Output is correct
4 Correct 26 ms 4056 KB Output is correct
5 Correct 75 ms 9680 KB Output is correct
6 Correct 101 ms 12240 KB Output is correct
7 Correct 112 ms 14608 KB Output is correct
8 Correct 227 ms 24012 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 604 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 468 KB Output is correct
23 Correct 2 ms 604 KB Output is correct
24 Correct 2 ms 348 KB Output is correct
25 Correct 2 ms 604 KB Output is correct
26 Correct 2 ms 600 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 344 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 1 ms 604 KB Output is correct
31 Correct 2 ms 604 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 2 ms 604 KB Output is correct
35 Correct 26 ms 4056 KB Output is correct
36 Correct 75 ms 9680 KB Output is correct
37 Correct 101 ms 12240 KB Output is correct
38 Correct 112 ms 14608 KB Output is correct
39 Correct 227 ms 24012 KB Output is correct
40 Correct 3 ms 860 KB Output is correct
41 Correct 8 ms 1372 KB Output is correct
42 Correct 10 ms 1908 KB Output is correct
43 Correct 98 ms 9944 KB Output is correct
44 Correct 205 ms 23920 KB Output is correct
45 Correct 33 ms 5084 KB Output is correct
46 Correct 112 ms 14476 KB Output is correct
47 Correct 216 ms 24008 KB Output is correct
48 Correct 199 ms 24192 KB Output is correct
49 Correct 174 ms 23500 KB Output is correct
50 Correct 161 ms 23500 KB Output is correct