답안 #1019821

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1019821 2024-07-11T09:15:34 Z KasymK Bali Sculptures (APIO15_sculpture) C++17
0 / 100
1000 ms 600 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); ++mk){
        ll sm = 0, cur = 0;
        int x = 1;
        for(int i = 0; i < n; ++i){
            sm += v[i];
            if(mk>>i&1)
                cur |= sm, sm = 0, x++;
        }
        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 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 432 KB Output is correct
5 Correct 1 ms 436 KB Output is correct
6 Correct 3 ms 348 KB Output is correct
7 Correct 8 ms 348 KB Output is correct
8 Correct 57 ms 412 KB Output is correct
9 Correct 57 ms 344 KB Output is correct
10 Correct 56 ms 348 KB Output is correct
11 Correct 57 ms 408 KB Output is correct
12 Correct 57 ms 344 KB Output is correct
13 Correct 57 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Incorrect 0 ms 348 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 352 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 352 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 3 ms 348 KB Output is correct
7 Correct 7 ms 440 KB Output is correct
8 Correct 59 ms 348 KB Output is correct
9 Correct 59 ms 600 KB Output is correct
10 Correct 57 ms 348 KB Output is correct
11 Correct 57 ms 348 KB Output is correct
12 Correct 56 ms 348 KB Output is correct
13 Correct 59 ms 348 KB Output is correct
14 Correct 0 ms 436 KB Output is correct
15 Incorrect 0 ms 348 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 1 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 8 ms 348 KB Output is correct
8 Correct 59 ms 348 KB Output is correct
9 Correct 69 ms 348 KB Output is correct
10 Correct 56 ms 412 KB Output is correct
11 Correct 61 ms 348 KB Output is correct
12 Correct 69 ms 348 KB Output is correct
13 Correct 60 ms 348 KB Output is correct
14 Correct 117 ms 348 KB Output is correct
15 Execution timed out 1079 ms 344 KB Time limit exceeded
16 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 1 ms 344 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 7 ms 436 KB Output is correct
8 Correct 56 ms 348 KB Output is correct
9 Correct 59 ms 600 KB Output is correct
10 Correct 56 ms 348 KB Output is correct
11 Correct 59 ms 348 KB Output is correct
12 Correct 57 ms 344 KB Output is correct
13 Correct 57 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Incorrect 0 ms 348 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 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 3 ms 344 KB Output is correct
7 Correct 8 ms 348 KB Output is correct
8 Correct 68 ms 348 KB Output is correct
9 Correct 56 ms 348 KB Output is correct
10 Correct 56 ms 348 KB Output is correct
11 Correct 56 ms 348 KB Output is correct
12 Correct 57 ms 408 KB Output is correct
13 Correct 57 ms 344 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 28 ms 348 KB Output is correct
18 Correct 52 ms 348 KB Output is correct
19 Correct 74 ms 344 KB Output is correct
20 Correct 57 ms 348 KB Output is correct
21 Correct 59 ms 348 KB Output is correct
22 Correct 56 ms 348 KB Output is correct
23 Correct 58 ms 348 KB Output is correct
24 Correct 114 ms 412 KB Output is correct
25 Execution timed out 1014 ms 344 KB Time limit exceeded
26 Halted 0 ms 0 KB -