Submission #31402

#TimeUsernameProblemLanguageResultExecution timeMemory
31402houtaruBali Sculptures (APIO15_sculpture)C++14
0 / 100
0 ms2032 KiB
#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 (stderr)

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);
                           ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...