Submission #104300

#TimeUsernameProblemLanguageResultExecution timeMemory
104300tduong0806Ice Hockey World Championship (CEOI15_bobek)C++14
100 / 100
453 ms8692 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int N=42; int n,x[N]; ll a[N],m,kq; vector<ll> e; void duyet(int i,int l,ll s) { if(i==l+1) { if(l==n/2) e.push_back(s); else kq+=upper_bound(e.begin(),e.end(),m-s)-e.begin(); return; } duyet(i+1,l,s); duyet(i+1,l,s+a[i]); } int main() { cin>>n>>m; for(int i=1;i<=n;++i) cin>>a[i]; duyet(1,n/2,0); sort(e.begin(),e.end()); duyet(n/2+1,n,0); cout<<kq; }
#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...