Submission #582931

#TimeUsernameProblemLanguageResultExecution timeMemory
582931Justin1Jakarta Skyscrapers (APIO15_skyscraper)C++14
0 / 100
1 ms212 KiB
#include <bits/stdc++.h> #define ll long long using namespace std; ll n,m,k,x,y,z; ll a,b; bool dp[105][2005][105]; ll ar[105]; signed main() { cin >> n >> a >> b; for (int i = 1; i <= n; i++) cin >> ar[i]; ll mxval = 0; for (int i = 1; i <= n; i++) mxval = max(mxval,ar[i]); for (int i = 1; i <= n; i++) ar[i] += ar[i-1]; dp[0][0][0] = 1; for (int i = 1; i <= n; i++) { //pos for (int j = 1; j <= n; j++) { //st pos for (int k = 1; k <= n; k++) { //groups for (int l = 0; l <= n*mxval; l++) { //total or if (dp[j-1][l][k-1]) dp[i][l|(ar[i]-ar[j-1])][k] = 1; } } } } for (int i = 0; i <= mxval*n; i++) { for (int j = a; j <= b; j++) { if (dp[n][i][j]) { cout << i << "\n"; return 0; } } } }
#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...