답안 #761611

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
761611 2023-06-20T05:30:59 Z gggkik 도넛 (JOI14_ho_t3) C++14
20 / 100
2000 ms 468 KB
#include <bits/stdc++.h>
using namespace std;
const int MXN = 1e5+5;
#define ll long long
ll A[MXN], P[MXN], n, all, T;
vector<ll> sa, sb;
ll sum(int i,int j){return (i<=j?P[j]-P[i-1]:0);}
int f(ll x){ // 답이 x 이상인가?
    return T>=x;
}
int main() {
    cin.tie(0)->sync_with_stdio(0);
    cin >> n;
    for(int i = 1;i<=n;i++){
        cin >> A[i]; P[i] = P[i-1]+A[i];
    }
    for(int i = 1;i<=n;i++){
        for(int j = i;j<=n;j++){
            for(int k = j+1;k<=n;k++){
                T = max(T,min({sum(i,j),sum(j+1,k),sum(k+1,n)+sum(1,i-1)}));
            }
        }
    }
    ll l = 0, r = P[n];
    for(;l+1<r;){
        ll mid = (l+r)/2;
        if(f(mid)) l = mid;
        else r = mid;
    }
    cout << l;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 19 ms 340 KB Output is correct
12 Correct 19 ms 332 KB Output is correct
13 Correct 19 ms 340 KB Output is correct
14 Correct 19 ms 336 KB Output is correct
15 Correct 19 ms 212 KB Output is correct
16 Correct 19 ms 212 KB Output is correct
17 Correct 23 ms 340 KB Output is correct
18 Correct 20 ms 468 KB Output is correct
19 Correct 19 ms 348 KB Output is correct
20 Correct 19 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 19 ms 340 KB Output is correct
12 Correct 19 ms 332 KB Output is correct
13 Correct 19 ms 340 KB Output is correct
14 Correct 19 ms 336 KB Output is correct
15 Correct 19 ms 212 KB Output is correct
16 Correct 19 ms 212 KB Output is correct
17 Correct 23 ms 340 KB Output is correct
18 Correct 20 ms 468 KB Output is correct
19 Correct 19 ms 348 KB Output is correct
20 Correct 19 ms 340 KB Output is correct
21 Execution timed out 2056 ms 340 KB Time limit exceeded
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 19 ms 340 KB Output is correct
12 Correct 19 ms 332 KB Output is correct
13 Correct 19 ms 340 KB Output is correct
14 Correct 19 ms 336 KB Output is correct
15 Correct 19 ms 212 KB Output is correct
16 Correct 19 ms 212 KB Output is correct
17 Correct 23 ms 340 KB Output is correct
18 Correct 20 ms 468 KB Output is correct
19 Correct 19 ms 348 KB Output is correct
20 Correct 19 ms 340 KB Output is correct
21 Execution timed out 2056 ms 340 KB Time limit exceeded
22 Halted 0 ms 0 KB -