답안 #1114340

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1114340 2024-11-18T15:47:28 Z vjudge1 Bigger segments (IZhO19_segments) C++17
27 / 100
1500 ms 71092 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main()
{
    int n; cin >> n;
    vector<int> a(n + 1), pref(n + 1);
    for (int i = 1;  i<= n; i++){
        cin >> a[i];
        pref[i] = pref[i - 1] + a[i];
    }
    vector<vector<int>> dp(n + 1, vector<int> (n + 1, 1e18));
    dp[0][0] = 0;
    for (int i = 1; i <= n; i++){
        for (int j = 0; j < i; j++){
           for (int k = 0; k < i; k++){
               int suma = pref[i] - pref[k];
               if (suma >= dp[k][j]){
                   dp[i][j + 1] = min(dp[i][j + 1], suma);
               }
           }
        }
    }
    
    int ans = 0;
    for (int i = 1; i <= n; i++){
        
        if (dp[n][i] != 1e18) ans = max(ans, i);
    }
    cout << ans << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 592 KB Output is correct
3 Correct 1 ms 440 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 592 KB Output is correct
3 Correct 1 ms 440 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 54 ms 2384 KB Output is correct
17 Correct 50 ms 2416 KB Output is correct
18 Correct 57 ms 2424 KB Output is correct
19 Correct 75 ms 2384 KB Output is correct
20 Correct 85 ms 2424 KB Output is correct
21 Correct 61 ms 2420 KB Output is correct
22 Correct 22 ms 1720 KB Output is correct
23 Correct 9 ms 1172 KB Output is correct
24 Correct 56 ms 2384 KB Output is correct
25 Correct 52 ms 2384 KB Output is correct
26 Correct 82 ms 2424 KB Output is correct
27 Correct 52 ms 2384 KB Output is correct
28 Correct 54 ms 2384 KB Output is correct
29 Correct 82 ms 2204 KB Output is correct
30 Correct 81 ms 2416 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 592 KB Output is correct
3 Correct 1 ms 440 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 54 ms 2384 KB Output is correct
17 Correct 50 ms 2416 KB Output is correct
18 Correct 57 ms 2424 KB Output is correct
19 Correct 75 ms 2384 KB Output is correct
20 Correct 85 ms 2424 KB Output is correct
21 Correct 61 ms 2420 KB Output is correct
22 Correct 22 ms 1720 KB Output is correct
23 Correct 9 ms 1172 KB Output is correct
24 Correct 56 ms 2384 KB Output is correct
25 Correct 52 ms 2384 KB Output is correct
26 Correct 82 ms 2424 KB Output is correct
27 Correct 52 ms 2384 KB Output is correct
28 Correct 54 ms 2384 KB Output is correct
29 Correct 82 ms 2204 KB Output is correct
30 Correct 81 ms 2416 KB Output is correct
31 Execution timed out 1586 ms 71092 KB Time limit exceeded
32 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 592 KB Output is correct
3 Correct 1 ms 440 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 54 ms 2384 KB Output is correct
17 Correct 50 ms 2416 KB Output is correct
18 Correct 57 ms 2424 KB Output is correct
19 Correct 75 ms 2384 KB Output is correct
20 Correct 85 ms 2424 KB Output is correct
21 Correct 61 ms 2420 KB Output is correct
22 Correct 22 ms 1720 KB Output is correct
23 Correct 9 ms 1172 KB Output is correct
24 Correct 56 ms 2384 KB Output is correct
25 Correct 52 ms 2384 KB Output is correct
26 Correct 82 ms 2424 KB Output is correct
27 Correct 52 ms 2384 KB Output is correct
28 Correct 54 ms 2384 KB Output is correct
29 Correct 82 ms 2204 KB Output is correct
30 Correct 81 ms 2416 KB Output is correct
31 Execution timed out 1586 ms 71092 KB Time limit exceeded
32 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 592 KB Output is correct
3 Correct 1 ms 440 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 54 ms 2384 KB Output is correct
17 Correct 50 ms 2416 KB Output is correct
18 Correct 57 ms 2424 KB Output is correct
19 Correct 75 ms 2384 KB Output is correct
20 Correct 85 ms 2424 KB Output is correct
21 Correct 61 ms 2420 KB Output is correct
22 Correct 22 ms 1720 KB Output is correct
23 Correct 9 ms 1172 KB Output is correct
24 Correct 56 ms 2384 KB Output is correct
25 Correct 52 ms 2384 KB Output is correct
26 Correct 82 ms 2424 KB Output is correct
27 Correct 52 ms 2384 KB Output is correct
28 Correct 54 ms 2384 KB Output is correct
29 Correct 82 ms 2204 KB Output is correct
30 Correct 81 ms 2416 KB Output is correct
31 Execution timed out 1586 ms 71092 KB Time limit exceeded
32 Halted 0 ms 0 KB -