This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
bool cmp(const vector<int>& a, const vector<int>& b) {
return *min_element(a.begin(), a.end()) < *min_element(b.begin(), b.end());
}
int main() {
#ifdef __local__
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int n;
cin >> n;
vector<int> lis(n);
for (int i = 0; i < n; i++) {
cin >> lis[i];
}
vector<vector<int>> sussies(n);
int k = (n + 1) / 2;
lis.insert(lis.end(), lis.begin(), lis.end());
for (int i = 0; i < n; i++) {
int cur = 0;
for (int j = 0; j < k; j++) {
cur += lis[i+j];
}
for (int j = 0; j < k; j++) {
sussies[(i+j)%n].push_back(cur);
}
}
vector<int> mins;
for (int i = 0; i < n; i++) {
mins.push_back(*min_element(sussies[i].begin(), sussies[i].end()));
}
int ans = *max_element(mins.begin(), mins.end());
cout << ans << endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |