Submission #213178

#TimeUsernameProblemLanguageResultExecution timeMemory
213178KoalaMuchBali Sculptures (APIO15_sculpture)C++14
50 / 100
106 ms512 KiB
#include<bits/stdc++.h> using namespace std; const int N = 2005; long long dp[N]; long long a[N]; int main() { long long n,l,r,fix = 0; scanf("%lld %lld %lld",&n,&l,&r); for(long long i=1;i<=n;i++) scanf("%lld",&a[i]); for(long long bit=41;bit>=0;bit--) { for(long long i=1;i<=n;i++) { dp[i] = 1e9; long long s = 0; for(long long j=i;j>=1;j--) { s+=a[j]; // if(bit==0&&i==7&&j==7) printf("[%lld %lld %lld %lld]\n",s,s|fix,s-(s&fix),dp[j-1]); if(s-(s&fix)<(1ll<<bit)&&dp[j-1]+1<=r) dp[i] = min(dp[i],dp[j-1]+1); } // if(!bit) printf("%lld %lld\n",i,dp[i]); } if(dp[n]==1e9) fix|=(1ll<<bit); } printf("%lld\n",fix); return 0; } /* 6 1 3 8 1 2 1 5 4 8 1 4 1 2 1 1 1 0 4 6 */

Compilation message (stderr)

sculpture.cpp: In function 'int main()':
sculpture.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld %lld %lld",&n,&l,&r);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
sculpture.cpp:10:40: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(long long i=1;i<=n;i++)   scanf("%lld",&a[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...