Submission #43503

#TimeUsernameProblemLanguageResultExecution timeMemory
43503HassoonyIce Hockey World Championship (CEOI15_bobek)C++14
10 / 100
124 ms33648 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int MX=42; ll n,m,a[MX]; vector<ll>v1,v2; void calc(int x,ll sum,int fin){ if(x==fin){ v1.push_back(sum); return; } calc(x+1,sum+a[x],fin); calc(x+1,sum,fin); } int main(){ scanf("%lld%lld",&n,&m); for(int i=0;i<n;i++){ scanf("%lld",&a[i]); } calc(0,0,n/2+1); v2=v1;v1.clear(); calc(n/2+1,0,n); ll ans=0; for(auto pp:v2){ ans+=upper_bound(v1.begin(),v1.end(),m-pp)-v1.begin(); } cout<<ans<<endl; }

Compilation message (stderr)

bobek.cpp: In function 'int main()':
bobek.cpp:17:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld%lld",&n,&m);
                            ^
bobek.cpp:19:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         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...
#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...