Submission #207627

#TimeUsernameProblemLanguageResultExecution timeMemory
207627DystoriaXBali Sculptures (APIO15_sculpture)C++14
21 / 100
30 ms2296 KiB
#include <bits/stdc++.h> using namespace std; int n, a, b; int y[100010]; long long dp[1010][3010]; long long pref[1010], mx; const int lgmx = 11; int main(){ // freopen("input.txt", "r", stdin); scanf("%d%d%d", &n, &a, &b); for(int i = 1; i <= n; i++){ scanf("%d", &y[i]); pref[i] = y[i] + pref[i - 1]; } for(int i = 1; i <= n; i++){ for(int j = 0; j < (1 << lgmx); j++){ dp[i][j] = 1e18; } } dp[0][0] = 0; for(int i = 0; i <= n; i++){ for(int j = 0; j < (1 << lgmx); j++){ if(dp[i][j] == 1e18) continue; for(int k = i + 1; k <= n; k++){ long long mask = j | (pref[k] - pref[i]); dp[k][mask] = min(dp[k][mask], dp[i][j] + 1); } } } for(int i = 0; i < (1 << lgmx); i++){ if(dp[n][i] <= b){ printf("%d\n", i); exit(0); } } return 0; }

Compilation message (stderr)

sculpture.cpp: In function 'int main()':
sculpture.cpp:14: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:17:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &y[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...