Submission #45759

# Submission time Handle Problem Language Result Execution time Memory
45759 2018-04-16T05:58:35 Z antimirage Bali Sculptures (APIO15_sculpture) C++17
9 / 100
1000 ms 262144 KB
#include <bits/stdc++.h>

#define fr first
#define sc second
#define mk make_pair
#define pb push_back
#define OK puts("OK");
#define sz(s) (int)s.size()
#define all(s) s.begin(), s.end()
#define int long long

using namespace std;

const int N = 2005, inf = 1e18;

int n, a, b, ar[N], pref[N], ans = 1e18;

vector <int> dp[N][N];

main()
{
    cin >> n >> a >> b;
    for (int i = 1; i <= n; i++)
        scanf("%lld", &ar[i]), pref[i] = ar[i] + pref[i - 1];

    dp[0][0].push_back( 0 );

    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= n; j++)
        {
            for (int k = 1; k <= j; k++)
            {
                for (auto it : dp[i - 1][k - 1])
                    dp[i][j].push_back( it | (pref[j] - pref[k - 1]) );
            }
        }
    }
    for (int i = a; i <= b; i++)
    {
        sort(all(dp[i][n]));
        ans = min(ans, dp[i][n][0]);
    }
    cout << ans << endl;
}

Compilation message

sculpture.cpp:20:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main()
      ^
sculpture.cpp: In function 'int main()':
sculpture.cpp:24:30: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld", &ar[i]), pref[i] = ar[i] + pref[i - 1];
         ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 75 ms 94712 KB Output is correct
2 Correct 74 ms 94712 KB Output is correct
3 Correct 77 ms 94764 KB Output is correct
4 Correct 76 ms 94764 KB Output is correct
5 Correct 76 ms 94960 KB Output is correct
6 Correct 76 ms 95256 KB Output is correct
7 Correct 80 ms 96276 KB Output is correct
8 Correct 89 ms 104188 KB Output is correct
9 Correct 88 ms 104196 KB Output is correct
10 Correct 87 ms 104196 KB Output is correct
11 Correct 86 ms 104220 KB Output is correct
12 Correct 91 ms 104220 KB Output is correct
13 Correct 95 ms 104240 KB Output is correct
14 Correct 76 ms 104240 KB Output is correct
15 Correct 77 ms 104240 KB Output is correct
16 Correct 75 ms 104240 KB Output is correct
17 Correct 75 ms 104240 KB Output is correct
18 Correct 77 ms 104240 KB Output is correct
19 Correct 78 ms 104240 KB Output is correct
20 Correct 79 ms 104240 KB Output is correct
21 Correct 88 ms 104240 KB Output is correct
22 Correct 89 ms 104240 KB Output is correct
23 Correct 93 ms 104240 KB Output is correct
24 Correct 87 ms 104240 KB Output is correct
25 Correct 89 ms 104240 KB Output is correct
26 Correct 99 ms 104240 KB Output is correct
27 Correct 76 ms 104240 KB Output is correct
28 Correct 76 ms 104240 KB Output is correct
29 Correct 77 ms 104240 KB Output is correct
30 Correct 83 ms 104240 KB Output is correct
31 Correct 90 ms 104264 KB Output is correct
32 Correct 93 ms 104284 KB Output is correct
33 Correct 102 ms 104284 KB Output is correct
34 Correct 96 ms 104284 KB Output is correct
35 Correct 87 ms 104284 KB Output is correct
36 Correct 95 ms 104284 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 76 ms 104284 KB Output is correct
2 Correct 77 ms 104284 KB Output is correct
3 Correct 78 ms 104284 KB Output is correct
4 Correct 76 ms 104284 KB Output is correct
5 Correct 76 ms 104284 KB Output is correct
6 Correct 79 ms 104284 KB Output is correct
7 Correct 90 ms 104284 KB Output is correct
8 Correct 95 ms 104284 KB Output is correct
9 Correct 89 ms 104284 KB Output is correct
10 Correct 88 ms 104284 KB Output is correct
11 Correct 86 ms 104284 KB Output is correct
12 Correct 86 ms 104284 KB Output is correct
13 Correct 96 ms 104284 KB Output is correct
14 Correct 76 ms 104284 KB Output is correct
15 Correct 75 ms 104284 KB Output is correct
16 Correct 83 ms 104284 KB Output is correct
17 Correct 82 ms 104284 KB Output is correct
18 Correct 81 ms 104284 KB Output is correct
19 Correct 81 ms 104284 KB Output is correct
20 Correct 83 ms 104284 KB Output is correct
21 Correct 93 ms 104284 KB Output is correct
22 Correct 93 ms 104284 KB Output is correct
23 Correct 92 ms 104284 KB Output is correct
24 Correct 91 ms 104284 KB Output is correct
25 Correct 92 ms 104284 KB Output is correct
26 Correct 122 ms 104284 KB Output is correct
27 Correct 135 ms 113264 KB Output is correct
28 Execution timed out 1115 ms 262144 KB Time limit exceeded
29 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 83 ms 262144 KB Output is correct
2 Correct 81 ms 262144 KB Output is correct
3 Correct 80 ms 262144 KB Output is correct
4 Correct 81 ms 262144 KB Output is correct
5 Correct 82 ms 262144 KB Output is correct
6 Correct 85 ms 262144 KB Output is correct
7 Correct 82 ms 262144 KB Output is correct
8 Correct 99 ms 262144 KB Output is correct
9 Correct 89 ms 262144 KB Output is correct
10 Correct 93 ms 262144 KB Output is correct
11 Correct 100 ms 262144 KB Output is correct
12 Correct 103 ms 262144 KB Output is correct
13 Correct 108 ms 262144 KB Output is correct
14 Correct 120 ms 262144 KB Output is correct
15 Execution timed out 1108 ms 262144 KB Time limit exceeded
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 83 ms 262144 KB Output is correct
2 Correct 80 ms 262144 KB Output is correct
3 Correct 81 ms 262144 KB Output is correct
4 Correct 84 ms 262144 KB Output is correct
5 Correct 84 ms 262144 KB Output is correct
6 Correct 81 ms 262144 KB Output is correct
7 Correct 82 ms 262144 KB Output is correct
8 Correct 100 ms 262144 KB Output is correct
9 Correct 110 ms 262144 KB Output is correct
10 Correct 104 ms 262144 KB Output is correct
11 Correct 95 ms 262144 KB Output is correct
12 Correct 92 ms 262144 KB Output is correct
13 Correct 108 ms 262144 KB Output is correct
14 Correct 88 ms 262144 KB Output is correct
15 Correct 87 ms 262144 KB Output is correct
16 Correct 98 ms 262144 KB Output is correct
17 Correct 80 ms 262144 KB Output is correct
18 Correct 82 ms 262144 KB Output is correct
19 Correct 75 ms 262144 KB Output is correct
20 Correct 83 ms 262144 KB Output is correct
21 Correct 88 ms 262144 KB Output is correct
22 Correct 89 ms 262144 KB Output is correct
23 Correct 88 ms 262144 KB Output is correct
24 Correct 88 ms 262144 KB Output is correct
25 Correct 90 ms 262144 KB Output is correct
26 Correct 98 ms 262144 KB Output is correct
27 Correct 77 ms 262144 KB Output is correct
28 Correct 77 ms 262144 KB Output is correct
29 Correct 76 ms 262144 KB Output is correct
30 Correct 83 ms 262144 KB Output is correct
31 Correct 87 ms 262144 KB Output is correct
32 Correct 88 ms 262144 KB Output is correct
33 Correct 103 ms 262144 KB Output is correct
34 Correct 97 ms 262144 KB Output is correct
35 Correct 87 ms 262144 KB Output is correct
36 Correct 98 ms 262144 KB Output is correct
37 Correct 123 ms 262144 KB Output is correct
38 Execution timed out 1099 ms 262144 KB Time limit exceeded
39 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 78 ms 262144 KB Output is correct
2 Correct 80 ms 262144 KB Output is correct
3 Correct 87 ms 262144 KB Output is correct
4 Correct 79 ms 262144 KB Output is correct
5 Correct 78 ms 262144 KB Output is correct
6 Correct 78 ms 262144 KB Output is correct
7 Correct 77 ms 262144 KB Output is correct
8 Correct 93 ms 262144 KB Output is correct
9 Correct 87 ms 262144 KB Output is correct
10 Correct 87 ms 262144 KB Output is correct
11 Correct 86 ms 262144 KB Output is correct
12 Correct 100 ms 262144 KB Output is correct
13 Correct 119 ms 262144 KB Output is correct
14 Correct 76 ms 262144 KB Output is correct
15 Correct 77 ms 262144 KB Output is correct
16 Correct 76 ms 262144 KB Output is correct
17 Correct 85 ms 262144 KB Output is correct
18 Correct 87 ms 262144 KB Output is correct
19 Correct 91 ms 262144 KB Output is correct
20 Correct 117 ms 262144 KB Output is correct
21 Correct 105 ms 262144 KB Output is correct
22 Correct 91 ms 262144 KB Output is correct
23 Correct 114 ms 262144 KB Output is correct
24 Correct 121 ms 262144 KB Output is correct
25 Execution timed out 1109 ms 262144 KB Time limit exceeded
26 Halted 0 ms 0 KB -