Submission #129358

#TimeUsernameProblemLanguageResultExecution timeMemory
129358arnold518Bali Sculptures (APIO15_sculpture)C++14
0 / 100
2 ms376 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int MAXN = 100; const ll INF = numeric_limits<ll>::max(); int N, A, B; ll Y[MAXN+10], dp[MAXN+10][MAXN+10], ans=INF; int main() { int i, j, k; scanf("%d%d%d", &N, &A, &B); for(i=1; i<=N; i++) scanf("%lld", &Y[i]), Y[i]+=Y[i-1]; dp[1][0]=INF; for(i=1; i<=N; i++) dp[1][i]=Y[i]; for(i=2; i<=N; i++) { for(j=1; j<=N; j++) { dp[i][j]=INF; for(k=1; k<j; k++) { dp[i][j]=min(dp[i][j], dp[i-1][k]|(Y[j]-Y[k])); } } } for(i=A; i<=B; i++) ans=min(ans, dp[i][N]); printf("%lld", ans); }

Compilation message (stderr)

sculpture.cpp: In function 'int main()':
sculpture.cpp:17:10: 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:18:45: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(i=1; i<=N; i++) scanf("%lld", &Y[i]), Y[i]+=Y[i-1];
                         ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
#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...