Submission #112122

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
1121222019-05-17 14:00:56Runtime_error_Bali Sculptures (APIO15_sculpture)C++14
0 / 100
80 ms512 KiB
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll inf=22,MX=1e18+9;
ll n,x,y,ans=MX,a[inf],pre[inf];
int main(){
scanf("%I64d%I64d%I64d",&n,&x,&y);
for(ll i=0;i<n;i++)
scanf("%I64d",a+i),pre[i]=a[i]+(i>0?pre[i-1]:0);
for(ll i=0;i<(1<<(n-1));i++){
ll mask=i|(1<<(n-1));
ll cnt=__builtin_popcount(mask);
if(cnt>y || cnt<x)
continue;
ll OR=0,last=0;
for(ll j=0;j<n;j++)
if((1<<j) & mask )
OR|=(pre[j]-pre[last]+a[last]),last=j+1;
ans=min(ans,OR);
}
printf("%I64d\n",ans);
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

sculpture.cpp: In function 'int main()':
sculpture.cpp:9:37: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
     scanf("%I64d%I64d%I64d",&n,&x,&y);
                             ~~      ^
sculpture.cpp:9:37: warning: format '%d' expects argument of type 'int*', but argument 3 has type 'long long int*' [-Wformat=]
sculpture.cpp:9:37: warning: format '%d' expects argument of type 'int*', but argument 4 has type 'long long int*' [-Wformat=]
sculpture.cpp:11:26: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
         scanf("%I64d",a+i),pre[i]=a[i]+(i>0?pre[i-1]:0);
                       ~~~^
sculpture.cpp:26:25: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long long int' [-Wformat=]
     printf("%I64d\n",ans);
                         ^
sculpture.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%I64d%I64d%I64d",&n,&x,&y);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
sculpture.cpp:11:27: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%I64d",a+i),pre[i]=a[i]+(i>0?pre[i-1]: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...