답안 #110221

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
110221 2019-05-10T08:31:27 Z SamAnd Bali Sculptures (APIO15_sculpture) C++17
9 / 100
1000 ms 512 KB
#include <bits/stdc++.h>
using namespace std;
const int N = 2003;

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

void solv0()
{
    long long ans = (1LL << 62);
    for (int x = 0; x < (1 << n); ++x)
    {
        if ((x & (1 << 0)) == 0)
            continue;
        vector<long long> v;
        long long 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);
        long long 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)
                               ~~~~~~~~~^~~~~
# 결과 실행 시간 메모리 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 256 KB Output is correct
6 Correct 7 ms 384 KB Output is correct
7 Correct 24 ms 256 KB Output is correct
8 Correct 137 ms 360 KB Output is correct
9 Correct 171 ms 360 KB Output is correct
10 Correct 138 ms 368 KB Output is correct
11 Correct 160 ms 368 KB Output is correct
12 Correct 139 ms 384 KB Output is correct
13 Correct 167 ms 256 KB Output is correct
14 Correct 2 ms 384 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 256 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 10 ms 356 KB Output is correct
20 Correct 36 ms 368 KB Output is correct
21 Correct 171 ms 360 KB Output is correct
22 Correct 185 ms 356 KB Output is correct
23 Correct 138 ms 356 KB Output is correct
24 Correct 146 ms 384 KB Output is correct
25 Correct 173 ms 356 KB Output is correct
26 Correct 153 ms 364 KB Output is correct
27 Correct 2 ms 256 KB Output is correct
28 Correct 2 ms 256 KB Output is correct
29 Correct 3 ms 256 KB Output is correct
30 Correct 72 ms 384 KB Output is correct
31 Correct 254 ms 384 KB Output is correct
32 Correct 140 ms 364 KB Output is correct
33 Correct 192 ms 356 KB Output is correct
34 Correct 139 ms 360 KB Output is correct
35 Correct 139 ms 356 KB Output is correct
36 Correct 195 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 7 ms 384 KB Output is correct
7 Correct 22 ms 256 KB Output is correct
8 Correct 173 ms 360 KB Output is correct
9 Correct 139 ms 384 KB Output is correct
10 Correct 177 ms 368 KB Output is correct
11 Correct 177 ms 256 KB Output is correct
12 Correct 176 ms 360 KB Output is correct
13 Correct 190 ms 356 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 4 ms 384 KB Output is correct
18 Correct 3 ms 384 KB Output is correct
19 Correct 6 ms 256 KB Output is correct
20 Correct 21 ms 432 KB Output is correct
21 Correct 154 ms 356 KB Output is correct
22 Correct 135 ms 256 KB Output is correct
23 Correct 157 ms 360 KB Output is correct
24 Correct 169 ms 356 KB Output is correct
25 Correct 177 ms 360 KB Output is correct
26 Correct 232 ms 360 KB Output is correct
27 Correct 329 ms 360 KB Output is correct
28 Execution timed out 1041 ms 512 KB Time limit exceeded
29 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 3 ms 256 KB Output is correct
3 Correct 3 ms 256 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 3 ms 256 KB Output is correct
6 Correct 8 ms 384 KB Output is correct
7 Correct 25 ms 432 KB Output is correct
8 Correct 241 ms 256 KB Output is correct
9 Correct 153 ms 376 KB Output is correct
10 Correct 167 ms 360 KB Output is correct
11 Correct 218 ms 384 KB Output is correct
12 Correct 166 ms 356 KB Output is correct
13 Correct 151 ms 384 KB Output is correct
14 Correct 354 ms 356 KB Output is correct
15 Execution timed out 1054 ms 256 KB Time limit exceeded
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 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 256 KB Output is correct
6 Correct 9 ms 372 KB Output is correct
7 Correct 21 ms 384 KB Output is correct
8 Correct 198 ms 364 KB Output is correct
9 Correct 174 ms 256 KB Output is correct
10 Correct 231 ms 256 KB Output is correct
11 Correct 163 ms 360 KB Output is correct
12 Correct 148 ms 256 KB Output is correct
13 Correct 217 ms 360 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 384 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 3 ms 384 KB Output is correct
19 Correct 6 ms 256 KB Output is correct
20 Correct 24 ms 256 KB Output is correct
21 Correct 172 ms 384 KB Output is correct
22 Correct 160 ms 376 KB Output is correct
23 Correct 139 ms 256 KB Output is correct
24 Correct 134 ms 384 KB Output is correct
25 Correct 145 ms 400 KB Output is correct
26 Correct 181 ms 376 KB Output is correct
27 Correct 2 ms 256 KB Output is correct
28 Correct 2 ms 384 KB Output is correct
29 Correct 4 ms 384 KB Output is correct
30 Correct 75 ms 476 KB Output is correct
31 Correct 153 ms 376 KB Output is correct
32 Correct 140 ms 396 KB Output is correct
33 Correct 140 ms 368 KB Output is correct
34 Correct 203 ms 384 KB Output is correct
35 Correct 162 ms 376 KB Output is correct
36 Correct 153 ms 384 KB Output is correct
37 Correct 314 ms 384 KB Output is correct
38 Execution timed out 1086 ms 384 KB Time limit exceeded
39 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 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 9 ms 256 KB Output is correct
7 Correct 19 ms 256 KB Output is correct
8 Correct 170 ms 376 KB Output is correct
9 Correct 172 ms 384 KB Output is correct
10 Correct 144 ms 356 KB Output is correct
11 Correct 152 ms 376 KB Output is correct
12 Correct 242 ms 384 KB Output is correct
13 Correct 158 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
16 Correct 3 ms 256 KB Output is correct
17 Correct 76 ms 384 KB Output is correct
18 Correct 226 ms 384 KB Output is correct
19 Correct 189 ms 384 KB Output is correct
20 Correct 163 ms 256 KB Output is correct
21 Correct 146 ms 432 KB Output is correct
22 Correct 216 ms 384 KB Output is correct
23 Correct 159 ms 256 KB Output is correct
24 Correct 374 ms 376 KB Output is correct
25 Execution timed out 1075 ms 384 KB Time limit exceeded
26 Halted 0 ms 0 KB -