답안 #31402

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
31402 2017-08-21T07:27:18 Z houtaru Bali Sculptures (APIO15_sculpture) C++14
0 / 100
0 ms 2032 KB
#include <bits/stdc++.h>
using namespace std;

const int N = 2222;

int n, a, b;
long long answer = 1e18;
long long y[N];

void load() {
    scanf("%d%d%d", &n, &a, &b);
    for (int i = 1; i <= n; ++i) {
        scanf("%d", y + i);
        y[i] += y[i - 1];
    }
}

void calc(int pre, int gr, long long sum) {
    if (gr == 1) {
        answer = min(answer, sum | (y[n] - y[pre]));
        return;
    }
    for (int i = pre + 1; i <= n - gr; ++i) {
        calc(i, gr - 1, sum | (y[i] - y[pre]));
    }
}

void process() {
    for (int x = a; x <= b; ++x)
        calc(0, x, 0);
    printf("%lld\n", answer);
}

int main() {
   // freopen("input.in", "r", stdin);
  //  freopen("output.out", "w", stdout);

    load();
    process();

    return 0;
}

Compilation message

sculpture.cpp: In function 'void load()':
sculpture.cpp:13:26: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
         scanf("%d", y + i);
                          ^
sculpture.cpp:11:32: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d%d", &n, &a, &b);
                                ^
sculpture.cpp:13:27: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", y + i);
                           ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2032 KB Output is correct
2 Incorrect 0 ms 2032 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2032 KB Output is correct
2 Incorrect 0 ms 2032 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2032 KB Output is correct
2 Incorrect 0 ms 2032 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2032 KB Output is correct
2 Incorrect 0 ms 2032 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2032 KB Output is correct
2 Incorrect 0 ms 2032 KB Output isn't correct
3 Halted 0 ms 0 KB -