Submission #111217

#TimeUsernameProblemLanguageResultExecution timeMemory
111217ppnxblstrBali Sculptures (APIO15_sculpture)C++14
50 / 100
310 ms536 KiB
#include <bits/stdc++.h> using namespace std; int arr[2048]; long long qs[2048]; int dp[2048]; int main(){ int n,a,b; scanf("%d%d%d",&n,&a,&b); for(int i = 1; i <= n; i++){ scanf("%d",arr+i); qs[i] = qs[i-1] + arr[i]; } long long ans = 0ll; for(int i = 60; i >= 0; i--){ for(int j = 1; j <= n; j++){ dp[j] = 4000; for(int l = 0; l < j; l++){ if(((((qs[j] - qs[l]) >> (long long)i) << (long long)i) | ans) == ans){ dp[j] = min(dp[j], dp[l]+1); } } } if(dp[n] > b){ ans += 1ll << (long long)i; } } printf("%lld\n",ans); return 0; } /* 6 1 3 8 1 2 1 5 4 */ /* 5 1 4 100 100 100 100 100 */

Compilation message (stderr)

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