Submission #996779

# Submission time Handle Problem Language Result Execution time Memory
996779 2024-06-11T08:03:54 Z daffuwu Bigger segments (IZhO19_segments) C++14
27 / 100
1500 ms 16720 KB
#include <bits/stdc++.h>
using namespace std;
#define fr first
#define sc second
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

int dp[3069][3069], n, a;
long long ps[500069];

int main() 
{
    int i, j, idx;
    scanf("%d", &n);
    for (i=1; i<=n; i++)
    {
        scanf("%d", &a);
        ps[i] = ps[i-1]+a;
    }
    ps[n+1] = 1e17;
    for (i=1; i<=n; i++)
    {
        for (idx=i+1; idx<=n+1; idx++)
        {
            dp[i][idx] = -1e9;
            for (j=0; j<=i-1; j++)
            {
                if (ps[idx]-ps[i]>=ps[i]-ps[j]) dp[i][idx] = max(dp[i][idx], 1+dp[j][i]);
            }
        }
    }
    printf("%d\n", dp[n][n+1]);    
}

Compilation message

segments.cpp: In function 'int main()':
segments.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
segments.cpp:16:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |         scanf("%d", &a);
      |         ~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2392 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2392 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 0 ms 2396 KB Output is correct
11 Correct 0 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 0 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2392 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2392 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 0 ms 2396 KB Output is correct
11 Correct 0 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 0 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 23 ms 8644 KB Output is correct
17 Correct 31 ms 8532 KB Output is correct
18 Correct 23 ms 8540 KB Output is correct
19 Correct 23 ms 8528 KB Output is correct
20 Correct 23 ms 8664 KB Output is correct
21 Correct 23 ms 8640 KB Output is correct
22 Correct 13 ms 8540 KB Output is correct
23 Correct 6 ms 6492 KB Output is correct
24 Correct 23 ms 8660 KB Output is correct
25 Correct 23 ms 8540 KB Output is correct
26 Correct 30 ms 8532 KB Output is correct
27 Correct 23 ms 8660 KB Output is correct
28 Correct 23 ms 8540 KB Output is correct
29 Correct 23 ms 8536 KB Output is correct
30 Correct 23 ms 8540 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2392 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2392 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 0 ms 2396 KB Output is correct
11 Correct 0 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 0 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 23 ms 8644 KB Output is correct
17 Correct 31 ms 8532 KB Output is correct
18 Correct 23 ms 8540 KB Output is correct
19 Correct 23 ms 8528 KB Output is correct
20 Correct 23 ms 8664 KB Output is correct
21 Correct 23 ms 8640 KB Output is correct
22 Correct 13 ms 8540 KB Output is correct
23 Correct 6 ms 6492 KB Output is correct
24 Correct 23 ms 8660 KB Output is correct
25 Correct 23 ms 8540 KB Output is correct
26 Correct 30 ms 8532 KB Output is correct
27 Correct 23 ms 8660 KB Output is correct
28 Correct 23 ms 8540 KB Output is correct
29 Correct 23 ms 8536 KB Output is correct
30 Correct 23 ms 8540 KB Output is correct
31 Execution timed out 1547 ms 16720 KB Time limit exceeded
32 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2392 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2392 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 0 ms 2396 KB Output is correct
11 Correct 0 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 0 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 23 ms 8644 KB Output is correct
17 Correct 31 ms 8532 KB Output is correct
18 Correct 23 ms 8540 KB Output is correct
19 Correct 23 ms 8528 KB Output is correct
20 Correct 23 ms 8664 KB Output is correct
21 Correct 23 ms 8640 KB Output is correct
22 Correct 13 ms 8540 KB Output is correct
23 Correct 6 ms 6492 KB Output is correct
24 Correct 23 ms 8660 KB Output is correct
25 Correct 23 ms 8540 KB Output is correct
26 Correct 30 ms 8532 KB Output is correct
27 Correct 23 ms 8660 KB Output is correct
28 Correct 23 ms 8540 KB Output is correct
29 Correct 23 ms 8536 KB Output is correct
30 Correct 23 ms 8540 KB Output is correct
31 Execution timed out 1547 ms 16720 KB Time limit exceeded
32 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2392 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2392 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 0 ms 2396 KB Output is correct
11 Correct 0 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 0 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 23 ms 8644 KB Output is correct
17 Correct 31 ms 8532 KB Output is correct
18 Correct 23 ms 8540 KB Output is correct
19 Correct 23 ms 8528 KB Output is correct
20 Correct 23 ms 8664 KB Output is correct
21 Correct 23 ms 8640 KB Output is correct
22 Correct 13 ms 8540 KB Output is correct
23 Correct 6 ms 6492 KB Output is correct
24 Correct 23 ms 8660 KB Output is correct
25 Correct 23 ms 8540 KB Output is correct
26 Correct 30 ms 8532 KB Output is correct
27 Correct 23 ms 8660 KB Output is correct
28 Correct 23 ms 8540 KB Output is correct
29 Correct 23 ms 8536 KB Output is correct
30 Correct 23 ms 8540 KB Output is correct
31 Execution timed out 1547 ms 16720 KB Time limit exceeded
32 Halted 0 ms 0 KB -