Submission #168791

#TimeUsernameProblemLanguageResultExecution timeMemory
168791mosiashvililukaIce Hockey World Championship (CEOI15_bobek)C++14
20 / 100
1070 ms73296 KiB
#include<bits/stdc++.h> using namespace std; long long a,b,c,d,e,f[49],i,j,zx,xc,pas; map <long long, long long> m; map <long long, long long>::iterator t; set <pair <long long, long long> > s; set <pair <long long, long long> >::iterator it; int main(){ ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0); cin>>a>>b; for(c=0; c<a; c++) cin>>f[c]; d=min(20LL,a); for(c=0; c<(1<<d); c++){ e=0; for(i=0; i<d; i++){ if(((1<<i)&c)!=0) e+=f[i]; } m[e]++; } e=0; for(t=m.begin(); t!=m.end(); t++){ e+=(*t).second; s.insert(make_pair((*t).first,e)); } if(a<=20){ it=s.lower_bound(make_pair(b+1,0)); if(it==s.begin()){ cout<<0; }else{ it--; cout<<(*it).second; } return 0; } e=a-d; for(c=0; c<(1<<e); c++){ zx=c*(1<<d); xc=0; for(i=d; i<a; i++){ if(((1<<i)&c)!=0) xc+=f[i]; } it=s.lower_bound(make_pair(b+1-xc,0)); if(it==s.begin()){ }else{ it--; pas+=(*it).second; } } cout<<pas; return 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...
#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...