# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
633147 |
2022-08-21T16:57:05 Z |
a_aguilo |
Hacker (BOI15_hac) |
C++14 |
|
1000 ms |
852 KB |
#include<bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
vi pre, computers;
int N;
int calcInterval(int left, int right){
if(left > right) return pre[N-1] - (pre[left]-pre[right]);
return pre[right] - pre[left];
}
int main(){
cin >> N;
computers = vi(N);
pre = vi(N);
cin >> computers[0];
pre[0] = computers[0];
for(int i = 1; i < N; ++i){
cin>> computers[i];
pre[i] = pre[i-1] + computers[i];
}
int length = N/2 + N%2;
int ans = 0;
for(int start = 0; start < N; ++start){
int val = calcInterval((start-1 + N)%N, (start + length-1)%N);
for(int left = 0; left < N; ++left){
int right = (left + length)%N ;
if ((left < start and right>= start) or (right >= start and left > right)) val = min(val, calcInterval(left, right));
}
//cout << start << " " << val << endl;
ans = max(ans, val);
}
cout << ans << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
300 KB |
Output is correct |
3 |
Correct |
126 ms |
212 KB |
Output is correct |
4 |
Execution timed out |
1080 ms |
852 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |