Submission #45703

#TimeUsernameProblemLanguageResultExecution timeMemory
45703TalantBali Sculptures (APIO15_sculpture)C++17
0 / 100
2 ms700 KiB
#include <bits/stdc++.h> #define fr first #define sc second #define OK puts("OK"); #define pb push_back #define mk make_pair #define int long long using namespace std; typedef long long ll; const long long inf = (long long)1e18 + 7; const long long N = (long long)2e5 + 7; long long n,a,b; long long ar[N],p[N]; long long dp[2002][2002]; long long mn = inf; long long calc (long long l,long long r) { return (p[r] - p[l - 1]); } main () { cin >> n >> a >> b; for (long long i = 1; i <= n; i ++) for (long long j = 1; j <= b; j ++) dp[i][j] = inf; for (long long i = 1; i <= n; i ++) { cin >> ar[i]; p[i] = p[i - 1] + ar[i]; dp[i][1] = p[i]; } for (long long j = 2; j <= b; j ++) { for (long long i = 1; i <= n; i ++) { for (long long l = 1; l < i; l ++) { dp[i][j] = min(dp[i][j],dp[l][j - 1] | calc(l + 1,i)); } } } for (long long i = a; i <= b; i ++) mn = min(mn,dp[n][i]); cout << mn << endl; } /** 6 1 3 8 1 2 1 5 4 **/

Compilation message (stderr)

sculpture.cpp:26:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main () {
       ^
#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...