Submission #1020143

#TimeUsernameProblemLanguageResultExecution timeMemory
1020143KasymKBali Sculptures (APIO15_sculpture)C++17
0 / 100
1 ms444 KiB
#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() const int N = 2e3+5; ll dp[N][N], par[N]; int main(){ // freopen("file.txt", "r", stdin); int n, a, b; scanf("%d%d%d", &n, &a, &b); for(int i = 0; i <= n; ++i) for(int k = 0; k <= n; ++k) dp[i][k] = 1e18; vector<int> v(n); for(int &i : v) scanf("%d", &i); for(int i = 1; i <= n; ++i) par[i] = par[i-1]+v[i-1]; dp[0][0] = 0; for(int i = 1; i <= n; ++i) for(int k = 1; k <= b; ++k) for(int j = 0; j < i; ++j) dp[i][k] = min(dp[i][k], dp[j][k-1]|(par[i]-par[j])); ll ans = 1e18; for(int k = a; k <= b; ++k) ans = min(ans, dp[n][k]); printf("%lld", ans); return 0; }

Compilation message (stderr)

sculpture.cpp: In function 'int main()':
sculpture.cpp:16:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |     scanf("%d%d%d", &n, &a, &b);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~
sculpture.cpp:22:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |         scanf("%d", &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...