Submission #104298

#TimeUsernameProblemLanguageResultExecution timeMemory
104298tduong0806Ice Hockey World Championship (CEOI15_bobek)C++14
50 / 100
415 ms8688 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; #define forinc(i,a,b) for(int i=a;i<=b;++i) #define fordec(i,a,b) for(int i=a;i>=b;--i) #define forv(a,b) for(auto &a:b) #define pb push_back #define pii pair<int,int> #define fi first #define se second #define all(a) a.begin(),a.end() #define reset(f,x) memset(f,x,sizeof(f)) #define bit(x,i) ((x>>(i-1))&1) #define onbit(x,i) (x|(1<<(i-1))) #define offbit(x,i) (x&~(1<<(i-1))) #define read2(a,b) read(a),read(b) #define read3(a,b,c) read(a),read(b),read(c) const int N=42; int n,m,x[N]; ll a[N],kq; vector<ll> e; void duyet(int i,int l,int s) { if(i==l+1) { if(l==n/2) e.pb(s); else kq+=upper_bound(all(e),m-s)-e.begin(); return; } duyet(i+1,l,s); duyet(i+1,l,s+a[i]); } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); //freopen("BOBEK.inp","r",stdin); cin>>n>>m; forinc(i,1,n) cin>>a[i]; duyet(1,n/2,0); sort(all(e)); 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...