답안 #1020099

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1020099 2024-07-11T14:42:40 Z KasymK Bali Sculptures (APIO15_sculpture) C++17
9 / 100
909 ms 604 KB
#include "bits/stdc++.h"
using namespace std;
#define pb push_back
#define ll long long
#define ff first
#define ss second
#define all(v) v.begin(), v.end()

int main(){
    int n, a, b;
    scanf("%d%d%d", &n, &a, &b);
    vector<int> v(n);
    for(int &i : v)
        scanf("%d", &i);
    ll ans = 1e18;
    for(int mk = 0; mk < (1<<(n-1)); ++mk){
        ll sm = 0, cur = 0;
        int x = 1;
        for(int i = 0; i < n-1; ++i){
            sm += v[i];
            if(mk>>i&1)
                cur |= sm, sm = 0, x++;
        }
        sm += v.back();
        cur |= sm;
        if(a <= x and x <= b)
            ans = min(ans, cur);
    }
    printf("%lld", ans);
    return 0;
}

Compilation message

sculpture.cpp: In function 'int main()':
sculpture.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     scanf("%d%d%d", &n, &a, &b);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~
sculpture.cpp:14:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |         scanf("%d", &i);
      |         ~~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 4 ms 348 KB Output is correct
8 Correct 29 ms 348 KB Output is correct
9 Correct 29 ms 348 KB Output is correct
10 Correct 29 ms 348 KB Output is correct
11 Correct 31 ms 348 KB Output is correct
12 Correct 29 ms 348 KB Output is correct
13 Correct 29 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 4 ms 348 KB Output is correct
21 Correct 26 ms 432 KB Output is correct
22 Correct 26 ms 348 KB Output is correct
23 Correct 26 ms 348 KB Output is correct
24 Correct 29 ms 348 KB Output is correct
25 Correct 26 ms 344 KB Output is correct
26 Correct 26 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 15 ms 348 KB Output is correct
31 Correct 25 ms 348 KB Output is correct
32 Correct 29 ms 344 KB Output is correct
33 Correct 26 ms 344 KB Output is correct
34 Correct 29 ms 348 KB Output is correct
35 Correct 29 ms 348 KB Output is correct
36 Correct 29 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 432 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 440 KB Output is correct
7 Correct 4 ms 348 KB Output is correct
8 Correct 29 ms 348 KB Output is correct
9 Correct 29 ms 348 KB Output is correct
10 Correct 30 ms 348 KB Output is correct
11 Correct 29 ms 344 KB Output is correct
12 Correct 28 ms 432 KB Output is correct
13 Correct 29 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 440 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 4 ms 348 KB Output is correct
21 Correct 25 ms 348 KB Output is correct
22 Correct 26 ms 348 KB Output is correct
23 Correct 26 ms 344 KB Output is correct
24 Correct 33 ms 348 KB Output is correct
25 Correct 26 ms 344 KB Output is correct
26 Correct 26 ms 348 KB Output is correct
27 Correct 57 ms 344 KB Output is correct
28 Correct 903 ms 344 KB Output is correct
29 Incorrect 1 ms 348 KB Output isn't correct
30 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 604 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 4 ms 348 KB Output is correct
8 Correct 29 ms 436 KB Output is correct
9 Correct 29 ms 348 KB Output is correct
10 Correct 29 ms 348 KB Output is correct
11 Correct 29 ms 344 KB Output is correct
12 Correct 28 ms 356 KB Output is correct
13 Correct 28 ms 348 KB Output is correct
14 Correct 60 ms 348 KB Output is correct
15 Correct 903 ms 416 KB Output is correct
16 Incorrect 0 ms 348 KB Output isn't correct
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 2 ms 344 KB Output is correct
7 Correct 4 ms 348 KB Output is correct
8 Correct 29 ms 348 KB Output is correct
9 Correct 29 ms 344 KB Output is correct
10 Correct 29 ms 348 KB Output is correct
11 Correct 29 ms 408 KB Output is correct
12 Correct 31 ms 348 KB Output is correct
13 Correct 30 ms 344 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 436 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 4 ms 348 KB Output is correct
21 Correct 26 ms 436 KB Output is correct
22 Correct 26 ms 348 KB Output is correct
23 Correct 26 ms 436 KB Output is correct
24 Correct 29 ms 348 KB Output is correct
25 Correct 30 ms 432 KB Output is correct
26 Correct 26 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 15 ms 436 KB Output is correct
31 Correct 26 ms 348 KB Output is correct
32 Correct 29 ms 348 KB Output is correct
33 Correct 27 ms 424 KB Output is correct
34 Correct 29 ms 348 KB Output is correct
35 Correct 29 ms 348 KB Output is correct
36 Correct 31 ms 348 KB Output is correct
37 Correct 60 ms 348 KB Output is correct
38 Correct 909 ms 412 KB Output is correct
39 Incorrect 1 ms 348 KB Output isn't correct
40 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 4 ms 348 KB Output is correct
8 Correct 29 ms 348 KB Output is correct
9 Correct 29 ms 348 KB Output is correct
10 Correct 31 ms 596 KB Output is correct
11 Correct 29 ms 348 KB Output is correct
12 Correct 31 ms 348 KB Output is correct
13 Correct 29 ms 344 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 15 ms 436 KB Output is correct
18 Correct 26 ms 348 KB Output is correct
19 Correct 29 ms 348 KB Output is correct
20 Correct 26 ms 432 KB Output is correct
21 Correct 29 ms 348 KB Output is correct
22 Correct 32 ms 428 KB Output is correct
23 Correct 30 ms 348 KB Output is correct
24 Correct 58 ms 344 KB Output is correct
25 Correct 901 ms 344 KB Output is correct
26 Incorrect 0 ms 348 KB Output isn't correct
27 Halted 0 ms 0 KB -