Submission #129350

#TimeUsernameProblemLanguageResultExecution timeMemory
129350ksmzzang2003Bali Sculptures (APIO15_sculpture)C++14
0 / 100
2 ms376 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; int N,A,B; vector <ll> arr,psum; ll f(int i,int j) { if(j==1) return psum[i]; ll ret = 1987654321*1987654321; for(int k = 0;k<i;k++) ret = min(ret,f(k,j-1)|(psum[i]-psum[k])); return ret; } int main() { scanf("%d %d %d",&N,&A,&B); arr.resize(N); psum.resize(N); for(int i=0;i<N;i++) scanf("%lld",&arr[i]); psum[0] = arr[0] ; for(int i=1;i<N;i++) psum[i] = psum[i-1] + arr[i]; ll ans = 1987654321*1987654321; for(int i=A;i<=B;i++) ans = min(ans,f(N-1,i)); printf("%lld",ans); }

Compilation message (stderr)

sculpture.cpp: In function 'll f(int, int)':
sculpture.cpp:9:24: warning: integer overflow in expression [-Woverflow]
     ll ret = 1987654321*1987654321;
              ~~~~~~~~~~^~~~~~~~~~~
sculpture.cpp: In function 'int main()':
sculpture.cpp:21:24: warning: integer overflow in expression [-Woverflow]
     ll ans = 1987654321*1987654321;
              ~~~~~~~~~~^~~~~~~~~~~
sculpture.cpp:16: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:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i=0;i<N;i++) scanf("%lld",&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...