제출 #1295627

#제출 시각아이디문제언어결과실행 시간메모리
1295627al95ireyizIce Hockey World Championship (CEOI15_bobek)C++20
40 / 100
1100 ms123652 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define vll vector<ll> #define len(x) (ll)x.size() const ll INF = 1e9, INFL = 1e18; const ll MOD = 1e9 + 7; const ll maxn = 2e5 + 5; ll n, m, k = 0; void _() { // kasibligin uzu qara olsun ay Mahir cin >> n >> m; vll v, v2; for(ll i = 1, x; i <= n; i ++){ cin >> x; if(i <= n / 2) v.push_back(x); else v2.push_back(x); } map<ll, ll>mp, mp2; ll le = len(v), le2 = len(v2); for(ll i = 0; i < (1ll << le); i ++){ ll cm = 0; for(ll j = 0; j < len(v); j ++){ if(i & (1ll << j)) cm += v[j]; } if(cm > m) continue; mp[cm] ++; } for(ll i = 0; i < (1ll << le2); i ++){ ll cm = 0; for(ll j = 0; j < len(v2); j ++){ if(i & (1ll << j)) cm += v2[j]; } if(cm > m) continue; mp2[cm] ++; } ll cv = 0; for(auto [x, y] : mp){ for(auto [x2, y2] : mp2){ if(x + x2 <= m) cv += y * y2; else break; } } cout << cv << '\n'; } signed main() { cin.tie(0)->sync_with_stdio(0); ll t = 1; // cin >> t; while(t --) _(); }
#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...