제출 #1121517

#제출 시각아이디문제언어결과실행 시간메모리
1121517vjudge1Ice Hockey World Championship (CEOI15_bobek)C++17
40 / 100
1067 ms49584 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int min(int a,int b){ return (a < b ? a : b); } int max(int a,int b){ return (a > b ? a : b); } signed main(){ int n,m; cin >> n >> m; vector<int> sira(n); for(auto &i : sira)cin >> i; multiset<int> cvbs; int fsst = min(20,n); for(int mask=0;mask<(1 << fsst);++mask){ int curr = 0; for(int i=0;i<fsst;++i){ if(mask & (1 << i))curr += sira[i]; } if(curr > m)continue; else cvbs.insert(curr); } fsst = n - 20; int cvb=0; fsst = max(fsst,0); for(int mask=0;mask < (1 << fsst);++mask){ int curr = 0; for(int i=20;i<n;++i){ if(mask & (1 << (i - 20)))curr +=sira[i]; } if(curr > m)continue; else{ cvb += *cvbs.upper_bound(m - curr); } } cout << cvb; }
#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...