Submission #124222

#TimeUsernameProblemLanguageResultExecution timeMemory
124222kimbj0709Ice Hockey World Championship (CEOI15_bobek)C++17
100 / 100
615 ms20972 KiB
#include <bits/stdc++.h> using namespace std; typedef unsigned long long int ull; int main() { ull no_of_input,input,sum; ull total = 0; ull count = 0; vector<ull> vect1; vector<ull> vect2; vector<ull> vect3; vector<ull> vect4; cin >> no_of_input >> sum; for(int i=0;i<no_of_input;i++){ cin >> input; if(i%2==0){ vect1.push_back(input); } else{ vect3.push_back(input); } } for(int i=0;i<pow(2,vect1.size());i++){ for(int j=0;j<vect1.size();j++){ if(i & (1<<j)){ count += vect1[j]; } } vect2.push_back(count); count = 0; } for(int i=0;i<pow(2,vect3.size());i++){ for(int j=0;j<vect3.size();j++){ if(i & (1<<j)){ count += vect3[j]; } } vect4.push_back(count); count = 0; } sort(vect2.begin(),vect2.end()); sort(vect4.begin(),vect4.end()); for(int i=0;i<vect2.size();i++){ if(sum>=vect2[i]){ total += upper_bound(vect4.begin(),vect4.end(),(sum-vect2[i]))-vect4.begin(); //cout << total << "\n"; } } cout << total; }

Compilation message (stderr)

bobek.cpp: In function 'int main()':
bobek.cpp:14:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i=0;i<no_of_input;i++){
               ~^~~~~~~~~~~~
bobek.cpp:25:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int j=0;j<vect1.size();j++){
                 ~^~~~~~~~~~~~~
bobek.cpp:35:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int j=0;j<vect3.size();j++){
                 ~^~~~~~~~~~~~~
bobek.cpp:46:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i=0;i<vect2.size();i++){
               ~^~~~~~~~~~~~~
#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...