Submission #110218

# Submission time Handle Problem Language Result Execution time Memory
110218 2019-05-10T08:28:09 Z SamAnd Bali Sculptures (APIO15_sculpture) C++17
0 / 100
1000 ms 508 KB
#include <bits/stdc++.h>
using namespace std;
const int N = 2003;

int n;
int ll, rr;
int a[N];

void solv0()
{
    int ans = INT_MAX;
    for (int x = 0; x < (1 << n); ++x)
    {
        if ((x & (1 << 0)) == 0)
            continue;
        vector<int> v;
        int y = a[1];
        for (int i = 1; i < n; ++i)
        {
            if ((x & (1 << i)))
            {
                v.push_back(y);
                y = a[i + 1];
            }
            else
                y += a[i + 1];
        }
        v.push_back(y);
        int yans = 0;
        for (int i = 0; i < v.size(); ++i)
            yans = yans | v[i];
        if (ll <= v.size() && v.size() <= rr)
            ans = min(ans, yans);
    }
    cout << ans << endl;
}

int main()
{
    //freopen("input.txt", "r", stdin);
    cin >> n >> ll >> rr;
    for (int i = 1; i <= n; ++i)
        cin >> a[i];
    solv0();
    return 0;
}

Compilation message

sculpture.cpp: In function 'void solv0()':
sculpture.cpp:30:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int i = 0; i < v.size(); ++i)
                         ~~^~~~~~~~~~
sculpture.cpp:32:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (ll <= v.size() && v.size() <= rr)
             ~~~^~~~~~~~~~~
sculpture.cpp:32:40: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (ll <= v.size() && v.size() <= rr)
                               ~~~~~~~~~^~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 9 ms 256 KB Output is correct
7 Correct 23 ms 384 KB Output is correct
8 Correct 166 ms 504 KB Output is correct
9 Correct 155 ms 256 KB Output is correct
10 Correct 180 ms 384 KB Output is correct
11 Correct 131 ms 384 KB Output is correct
12 Correct 196 ms 256 KB Output is correct
13 Correct 156 ms 256 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 7 ms 256 KB Output is correct
20 Correct 20 ms 256 KB Output is correct
21 Correct 151 ms 504 KB Output is correct
22 Correct 149 ms 504 KB Output is correct
23 Correct 159 ms 256 KB Output is correct
24 Correct 153 ms 384 KB Output is correct
25 Correct 236 ms 504 KB Output is correct
26 Correct 165 ms 384 KB Output is correct
27 Incorrect 3 ms 384 KB Output isn't correct
28 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 8 ms 384 KB Output is correct
7 Correct 23 ms 384 KB Output is correct
8 Correct 147 ms 384 KB Output is correct
9 Correct 169 ms 508 KB Output is correct
10 Correct 160 ms 384 KB Output is correct
11 Correct 166 ms 508 KB Output is correct
12 Correct 159 ms 392 KB Output is correct
13 Correct 174 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 3 ms 384 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 7 ms 256 KB Output is correct
20 Correct 28 ms 384 KB Output is correct
21 Correct 186 ms 384 KB Output is correct
22 Correct 158 ms 504 KB Output is correct
23 Correct 151 ms 504 KB Output is correct
24 Correct 156 ms 384 KB Output is correct
25 Correct 153 ms 476 KB Output is correct
26 Correct 134 ms 384 KB Output is correct
27 Correct 326 ms 400 KB Output is correct
28 Execution timed out 1069 ms 384 KB Time limit exceeded
29 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 7 ms 384 KB Output is correct
7 Correct 30 ms 384 KB Output is correct
8 Correct 163 ms 256 KB Output is correct
9 Correct 159 ms 504 KB Output is correct
10 Correct 133 ms 476 KB Output is correct
11 Correct 168 ms 384 KB Output is correct
12 Correct 151 ms 384 KB Output is correct
13 Correct 135 ms 256 KB Output is correct
14 Correct 303 ms 384 KB Output is correct
15 Execution timed out 1063 ms 384 KB Time limit exceeded
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 256 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 7 ms 384 KB Output is correct
7 Correct 19 ms 384 KB Output is correct
8 Correct 163 ms 360 KB Output is correct
9 Correct 181 ms 392 KB Output is correct
10 Correct 133 ms 384 KB Output is correct
11 Correct 146 ms 356 KB Output is correct
12 Correct 156 ms 384 KB Output is correct
13 Correct 137 ms 504 KB Output is correct
14 Correct 3 ms 384 KB Output is correct
15 Correct 4 ms 384 KB Output is correct
16 Correct 3 ms 384 KB Output is correct
17 Correct 3 ms 256 KB Output is correct
18 Correct 3 ms 384 KB Output is correct
19 Correct 8 ms 384 KB Output is correct
20 Correct 27 ms 384 KB Output is correct
21 Correct 153 ms 476 KB Output is correct
22 Correct 142 ms 360 KB Output is correct
23 Correct 142 ms 256 KB Output is correct
24 Correct 162 ms 384 KB Output is correct
25 Correct 164 ms 384 KB Output is correct
26 Correct 142 ms 384 KB Output is correct
27 Incorrect 2 ms 256 KB Output isn't correct
28 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 6 ms 256 KB Output is correct
7 Correct 22 ms 384 KB Output is correct
8 Correct 147 ms 384 KB Output is correct
9 Correct 161 ms 504 KB Output is correct
10 Correct 161 ms 476 KB Output is correct
11 Correct 143 ms 384 KB Output is correct
12 Correct 162 ms 504 KB Output is correct
13 Correct 142 ms 384 KB Output is correct
14 Incorrect 2 ms 384 KB Output isn't correct
15 Halted 0 ms 0 KB -