제출 #1121588

#제출 시각아이디문제언어결과실행 시간메모리
1121588vjudge1Ice Hockey World Championship (CEOI15_bobek)C++17
40 / 100
347 ms8744 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; signed main(){ int n,m; cin >> n >> m; int aa; if(n == 1){ cin >> aa; cout << (aa > m ? 0 : 1); return 0; } int hmm = 0; vector<int> a(n/2),b(n - a.size()); for(auto &i : a){ cin >> i; hmm += i; } for(auto &i : b){ cin >> i; hmm += i; } vector<ll> cvbss; for(int mask=0;mask<(1 << a.size());++mask){ ll curr=0; for(int i=0;i<a.size();++i){ if(mask & (1 << i))curr += 1LL * a[i]; } if(curr > m)continue; else cvbss.push_back(curr); } sort(cvbss.begin(),cvbss.end()); ll cvb=0LL; for(int mask=0;mask < (1 << b.size());++mask){ ll curr = 0; for(int i=0;i<b.size();++i){ if(mask & (1 << i))curr += 1LL * b[i]; } if(curr > m)continue; else cvb = cvb + (upper_bound(cvbss.begin(),cvbss.end(),m - curr) - cvbss.begin()); } cout << cvb; }

컴파일 시 표준 에러 (stderr) 메시지

bobek.cpp: In function 'int main()':
bobek.cpp:27:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |         for(int i=0;i<a.size();++i){
      |                     ~^~~~~~~~~
bobek.cpp:37:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |         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...