Submission #1121521

#TimeUsernameProblemLanguageResultExecution timeMemory
1121521vjudge1Ice Hockey World Championship (CEOI15_bobek)C++17
100 / 100
361 ms8736 KiB
#pragma GCC optimize("O2,O3,Ofast,unroll-loops") #pragma GCC target("sse,sse2,sse3,sse4,sse4.1,sse4.2,popcnt,lzcnt,abm,mmx,avx,avx2,fma,bmi,bmi2") #include <bits/stdc++.h> #define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define ll long long using namespace std; int main(){ fast; ll a,b,x; cin>>a>>b; vector<ll>p1,p2,v; for(ll i=0;i<a;i++){ cin>>x; if(i<((a+1)/2)) p1.push_back(x); else p2.push_back(x); } for(ll i=0;i<(1<<p2.size());i++){ ll sum=0; for(ll j=0;j<p2.size();j++){ if(i&(1<<j)){ sum+=p2[j]; } } v.push_back(sum); } sort(v.begin(),v.end()); ll cvb=0,sum=0; for(ll i = 0;i<(1<<p1.size());i++){ ll sum=0; for(ll j=0;j<p1.size();j++){ if(i&(1<<j)){ sum+=p1[j]; } } cvb+=upper_bound(v.begin(),v.end(),(b-sum))-v.begin(); } cout<<cvb; }

Compilation message (stderr)

bobek.cpp: In function 'int main()':
bobek.cpp:20:21: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |         for(ll j=0;j<p2.size();j++){
      |                    ~^~~~~~~~~~
bobek.cpp:31:21: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |         for(ll j=0;j<p1.size();j++){
      |                    ~^~~~~~~~~~
bobek.cpp:28:14: warning: unused variable 'sum' [-Wunused-variable]
   28 |     ll cvb=0,sum=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...