Submission #249015

# Submission time Handle Problem Language Result Execution time Memory
249015 2020-07-14T05:20:22 Z SamAnd Bali Sculptures (APIO15_sculpture) C++17
71 / 100
35 ms 512 KB
#include <bits/stdc++.h>
using namespace std;
#define m_p make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
typedef long long ll;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rnf(2106);
const int N4 = 102, N5 = 2002;

int n, ul, ur;
int a[N5];

void ka()
{
    scanf("%d%d%d", &n, &ul, &ur);
    for (int i = 1; i <= n; ++i)
        scanf("%d", &a[i]);
}

void solv4()
{
    bool dp[N4][N4];
    ll ans = 0;
    for (int i = 50; i >= 0; --i)
    {
        memset(dp, false, sizeof dp);
        dp[0][0] = true;
        for (int j = 1; j <= n; ++j)
        {
            ll s = 0;
            for (int k = j; k >= 1; --k)
            {
                s += a[k];
                if (((ans >> i) & (s >> i)) != (s >> i))
                    continue;
                for (int q = 0; q <= n; ++q)
                {
                    if (dp[k - 1][q])
                        dp[j][q + 1] = true;
                }
            }
        }
        bool z = false;
        for (int q = ul; q <= ur; ++q)
        {
            if (dp[n][q])
            {
                z = true;
                break;
            }
        }
        if (!z)
        {
            ans |= (1LL << i);
        }
    }
    printf("%lld\n", ans);
}

int main()
{
    #ifdef SOMETHING
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #endif // SOMETHING
    ka();
    solv4();
    return 0;
}

//while ((double)clock() / CLOCKS_PER_SEC <= 0.9){}

Compilation message

sculpture.cpp: In function 'void ka()':
sculpture.cpp:18:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d%d", &n, &ul, &ur);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
sculpture.cpp:20:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &a[i]);
         ~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 0 ms 384 KB Output is correct
15 Correct 0 ms 384 KB Output is correct
16 Correct 0 ms 384 KB Output is correct
17 Correct 1 ms 384 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 1 ms 384 KB Output is correct
23 Correct 1 ms 384 KB Output is correct
24 Correct 1 ms 384 KB Output is correct
25 Correct 1 ms 384 KB Output is correct
26 Correct 1 ms 384 KB Output is correct
27 Correct 0 ms 384 KB Output is correct
28 Correct 0 ms 384 KB Output is correct
29 Correct 0 ms 384 KB Output is correct
30 Correct 1 ms 384 KB Output is correct
31 Correct 1 ms 384 KB Output is correct
32 Correct 1 ms 384 KB Output is correct
33 Correct 1 ms 384 KB Output is correct
34 Correct 1 ms 384 KB Output is correct
35 Correct 1 ms 384 KB Output is correct
36 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 0 ms 384 KB Output is correct
15 Correct 0 ms 384 KB Output is correct
16 Correct 0 ms 384 KB Output is correct
17 Correct 0 ms 384 KB Output is correct
18 Correct 0 ms 388 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 1 ms 384 KB Output is correct
23 Correct 1 ms 384 KB Output is correct
24 Correct 1 ms 384 KB Output is correct
25 Correct 1 ms 384 KB Output is correct
26 Correct 1 ms 384 KB Output is correct
27 Correct 1 ms 384 KB Output is correct
28 Correct 1 ms 384 KB Output is correct
29 Correct 2 ms 384 KB Output is correct
30 Correct 3 ms 384 KB Output is correct
31 Correct 6 ms 384 KB Output is correct
32 Correct 5 ms 384 KB Output is correct
33 Correct 5 ms 384 KB Output is correct
34 Correct 5 ms 384 KB Output is correct
35 Correct 5 ms 384 KB Output is correct
36 Correct 7 ms 392 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 0 ms 308 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 3 ms 384 KB Output is correct
18 Correct 4 ms 384 KB Output is correct
19 Correct 4 ms 384 KB Output is correct
20 Correct 5 ms 384 KB Output is correct
21 Correct 4 ms 384 KB Output is correct
22 Correct 4 ms 384 KB Output is correct
23 Correct 5 ms 384 KB Output is correct
24 Correct 5 ms 384 KB Output is correct
25 Correct 8 ms 384 KB Output is correct
26 Correct 16 ms 384 KB Output is correct
27 Correct 18 ms 384 KB Output is correct
28 Correct 25 ms 384 KB Output is correct
29 Correct 23 ms 384 KB Output is correct
30 Correct 25 ms 384 KB Output is correct
31 Correct 24 ms 384 KB Output is correct
32 Correct 24 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 0 ms 384 KB Output is correct
16 Correct 0 ms 384 KB Output is correct
17 Correct 0 ms 384 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 1 ms 384 KB Output is correct
23 Correct 1 ms 384 KB Output is correct
24 Correct 1 ms 384 KB Output is correct
25 Correct 1 ms 384 KB Output is correct
26 Correct 1 ms 384 KB Output is correct
27 Correct 0 ms 384 KB Output is correct
28 Correct 0 ms 384 KB Output is correct
29 Correct 0 ms 384 KB Output is correct
30 Correct 1 ms 384 KB Output is correct
31 Correct 1 ms 384 KB Output is correct
32 Correct 1 ms 384 KB Output is correct
33 Correct 1 ms 384 KB Output is correct
34 Correct 1 ms 384 KB Output is correct
35 Correct 1 ms 384 KB Output is correct
36 Correct 1 ms 384 KB Output is correct
37 Correct 1 ms 384 KB Output is correct
38 Correct 1 ms 384 KB Output is correct
39 Correct 2 ms 384 KB Output is correct
40 Correct 3 ms 384 KB Output is correct
41 Correct 4 ms 384 KB Output is correct
42 Correct 4 ms 384 KB Output is correct
43 Correct 5 ms 384 KB Output is correct
44 Correct 4 ms 384 KB Output is correct
45 Correct 4 ms 384 KB Output is correct
46 Correct 4 ms 384 KB Output is correct
47 Correct 4 ms 384 KB Output is correct
48 Correct 8 ms 384 KB Output is correct
49 Correct 13 ms 384 KB Output is correct
50 Correct 19 ms 384 KB Output is correct
51 Correct 24 ms 384 KB Output is correct
52 Correct 35 ms 384 KB Output is correct
53 Correct 25 ms 384 KB Output is correct
54 Correct 27 ms 384 KB Output is correct
55 Correct 24 ms 384 KB Output is correct
56 Correct 2 ms 384 KB Output is correct
57 Correct 6 ms 384 KB Output is correct
58 Correct 8 ms 384 KB Output is correct
59 Correct 10 ms 384 KB Output is correct
60 Correct 10 ms 384 KB Output is correct
61 Correct 10 ms 384 KB Output is correct
62 Correct 13 ms 384 KB Output is correct
63 Correct 13 ms 384 KB Output is correct
64 Correct 20 ms 384 KB Output is correct
65 Correct 2 ms 384 KB Output is correct
66 Correct 4 ms 384 KB Output is correct
67 Correct 6 ms 384 KB Output is correct
68 Correct 8 ms 384 KB Output is correct
69 Correct 11 ms 384 KB Output is correct
70 Correct 10 ms 384 KB Output is correct
71 Correct 10 ms 384 KB Output is correct
72 Correct 12 ms 384 KB Output is correct
73 Correct 12 ms 384 KB Output is correct
74 Correct 12 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 0 ms 384 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 1 ms 384 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 1 ms 384 KB Output is correct
23 Correct 1 ms 384 KB Output is correct
24 Correct 1 ms 384 KB Output is correct
25 Correct 1 ms 384 KB Output is correct
26 Correct 2 ms 384 KB Output is correct
27 Correct 3 ms 384 KB Output is correct
28 Correct 4 ms 384 KB Output is correct
29 Correct 4 ms 384 KB Output is correct
30 Correct 6 ms 384 KB Output is correct
31 Correct 5 ms 384 KB Output is correct
32 Correct 4 ms 384 KB Output is correct
33 Correct 4 ms 388 KB Output is correct
34 Correct 5 ms 384 KB Output is correct
35 Correct 8 ms 384 KB Output is correct
36 Correct 13 ms 384 KB Output is correct
37 Correct 20 ms 384 KB Output is correct
38 Correct 24 ms 384 KB Output is correct
39 Correct 24 ms 384 KB Output is correct
40 Correct 25 ms 380 KB Output is correct
41 Correct 23 ms 384 KB Output is correct
42 Correct 24 ms 384 KB Output is correct
43 Correct 3 ms 384 KB Output is correct
44 Correct 6 ms 384 KB Output is correct
45 Correct 8 ms 384 KB Output is correct
46 Correct 10 ms 384 KB Output is correct
47 Correct 9 ms 384 KB Output is correct
48 Correct 14 ms 384 KB Output is correct
49 Correct 12 ms 384 KB Output is correct
50 Correct 14 ms 384 KB Output is correct
51 Correct 10 ms 384 KB Output is correct
52 Runtime error 8 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
53 Halted 0 ms 0 KB -