제출 #1127560

#제출 시각아이디문제언어결과실행 시간메모리
1127560AgageldiHacker (BOI15_hac)C++20
0 / 100
0 ms324 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define N 4000005 #define ff first #define ss second #define pb push_back #define sz(s) (int)s.size() #define rep(c, a, b) for(c = a; c <= b; c++) ll n, t, v[N], mx, sum, l, r, answer; map <ll,ll> vis; int main () { ios::sync_with_stdio(0);cin.tie(0); cin >> n; for(int i =1;i<=n;i++) { cin >> v[i]; } for(int i = 1; i <= n; i++) { l = i; r = i; t = 1; sum = 0; while(t <= (n + 1) / 2) { t++; sum += v[r]; r--; if(!r) r = n; } t = 1; mx = sum; while(t < (n + 1) / 2) { t++; l++; sum -= v[r]; sum += v[l]; r++; if(l == n + 1) l = 1; if(r == n + 1) r = 1; mx = min(mx,sum); } answer = max(answer,mx); } cout << answer << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...