답안 #168336

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
168336 2019-12-12T14:26:18 Z IldarKA Bigger segments (IZhO19_segments) C++14
0 / 100
3 ms 376 KB
#include <bits/stdc++.h>

using namespace std;
int n, a[500001], dp[3001][3001];
int main(){
    cin >> n;
    for(int i = 1;  i <= n; i++){
        cin >> a[i];
        dp[1][i] = 1;
    }
    for(int i = 2; i <= n; i++){
        int po = i - 1;
        long long sum = 0;
        long long sum2 = 0;
        int mx = 0;
        for(int j = i; j <= n; j++){
            sum += a[j];
            while(po > 0 && sum2 + a[po] <= sum){
                sum2 += a[po];
                mx = max(dp[po][i - 1], mx);
                po--;
            }
            if(po < i - 1){
                dp[i][j] = mx + 1;
            }
        }
    }
    int mx = 0;
    for(int i = 1; i <= n; i++){
        mx = max(dp[i][n], mx);
    }
    cout << mx;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Incorrect 2 ms 376 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Incorrect 2 ms 376 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Incorrect 2 ms 376 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Incorrect 2 ms 376 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Incorrect 2 ms 376 KB Output isn't correct
5 Halted 0 ms 0 KB -