Submission #453009

#TimeUsernameProblemLanguageResultExecution timeMemory
453009nonsensenonsense1Bali Sculptures (APIO15_sculpture)C++17
71 / 100
53 ms332 KiB
#include <cstdio> const int LG = 60; const int N = 100; int n, a, b, y[N]; bool d[N + 1][N + 1]; bool test(long long x, int l) { for (int i = 1; i <= n; ++i) for (int j = 1; j <= i; ++j) { d[i][j] = 0; long long s = 0; for (int k = i - 1; k >= 0; --k) { s += y[k]; if (((x | s) & ~(((long long)1 << l) - 1)) == x) d[i][j] = d[i][j] || d[k][j - 1]; } if (i == n && j >= a && j <= b && d[i][j]) return true; } return false; } int main() { scanf("%d%d%d", &n, &a, &b); for (int i = 0; i < n; ++i) scanf("%d", y + i); long long ans = 0; d[0][0] = 1; for (int i = LG - 1; i >= 0; --i) if (!test(ans, i)) ans |= (long long)1 << i; printf("%lld\n", ans); return 0; }

Compilation message (stderr)

sculpture.cpp: In function 'int main()':
sculpture.cpp:24:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |  scanf("%d%d%d", &n, &a, &b);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~~~~
sculpture.cpp:25:35: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |  for (int i = 0; i < n; ++i) 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...