제출 #1122120

#제출 시각아이디문제언어결과실행 시간메모리
1122120AlmontherIce Hockey World Championship (CEOI15_bobek)C++98
100 / 100
432 ms10840 KiB
#include<bits/stdc++.h> #define suiii ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define co cout<< #define ll long long using namespace std; //stuff void solve(){ ll n,k; cin>>n>>k; ll arr[n+5]; vector<ll>v; for(int i=0;i<n;i++) cin>>arr[i]; ll n1=n/2,ans=0; for(int i=0;i<exp2(n1);i++){ ll sum=0; ll x=i; for(int j=0;j<n1;j++) if(((x>>j)&1)) sum+=arr[j]; v.push_back(sum); } sort(v.begin(),v.end()); for(int i=0;i<exp2(n-n1);i++){ ll sum=0; ll x=i; for(int j=0;j<n-n1;j++) if(((x>>j)&1)) sum+=arr[j+n1]; ans+=upper_bound(v.begin(),v.end(),k-sum)-v.begin(); } co ans<<'\n'; } int main(){ suiii int _=1; // cin>>_; while(_--) solve(); }
#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...