Submission #551314

#TimeUsernameProblemLanguageResultExecution timeMemory
551314radaiosm7Bali Sculptures (APIO15_sculpture)C++98
0 / 100
1 ms340 KiB
#include <bits/stdc++.h> using namespace std; int n, a, b, i, j, k; long long pref[2005]; long long ar[2005]; long long dp[2005][2005]; long long ans; int main() { scanf("%d%d%d", &n, &a, &b); for (i=1; i <= n; ++i) scanf("%lld", &ar[i]); pref[0] = 0LL; for (i=1; i <= n; ++i) pref[i] = pref[i-1]+ar[i]; for (i=0; i <= b; ++i) dp[0][i] = 0; for (i=2; i <= n; ++i) { dp[i][1] = pref[i]; for (j=2; j <= b; ++j) { dp[i][j] = INT_MAX; for (k=i-1; k >= 0; --k) dp[i][j] = min(dp[i][j], dp[k][j-1]|(pref[i]-pref[k])); } } ans = INT_MAX; for (i=a; i <= b; ++i) ans = min(ans, dp[n][i]); printf("%lld\n", ans); return 0; }

Compilation message (stderr)

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