Submission #1121601

#TimeUsernameProblemLanguageResultExecution timeMemory
1121601vjudge1Ice Hockey World Championship (CEOI15_bobek)C++17
100 / 100
362 ms8684 KiB
#include <bits/stdc++.h> using namespace std; #define int long long signed main(){ int n,m; cin >> n >> m; int aa; if(n == 1){ cin >> aa; cout << (aa > m ? 1: 2); return 0; } vector<int> a(n/2),b(n - a.size()); for(auto &i : a)cin >> i; for(auto &i : b)cin >> i; vector<int> cvbss; for(int mask=0;mask<(1 << a.size());++mask){ int curr=0; for(int i=0;i<a.size();++i){ if(mask & (1 << i))curr += a[i]; } if(curr > m)continue; else cvbss.push_back(curr); } sort(cvbss.begin(),cvbss.end()); int cvb=0; for(int mask=0;mask < (1 << b.size());++mask){ int curr = 0; for(int i=0;i<b.size();++i){ if(mask & (1 << i))curr += b[i]; } if(curr > m)continue; else cvb = cvb + (upper_bound(cvbss.begin(),cvbss.end(),m - curr) - cvbss.begin()); } cout << cvb; }

Compilation message (stderr)

bobek.cpp: In function 'int main()':
bobek.cpp:20:22: 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(int i=0;i<a.size();++i){
      |                     ~^~~~~~~~~
bobek.cpp:30:22: 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]
   30 |         for(int i=0;i<b.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...