Submission #436324

#TimeUsernameProblemLanguageResultExecution timeMemory
436324iulia13Ice Hockey World Championship (CEOI15_bobek)C++14
50 / 100
1097 ms228124 KiB
#include <bits/stdc++.h> using namespace std; const int N = 50; #define ll long long map <ll, ll> cate; map <ll, ll> dp; set <ll> s; ll v[N]; int main() { ll n, m, nr, i; cin >> n >> m; for (i = 1; i <= n; i++) { cin >> nr; if (nr > m) continue; if (s.empty()) { cate[nr] = 1; s.insert(nr); continue; } auto it = s.end(); while(it != s.begin()) { it--; ll val = *it; if (val + nr > m) continue; if (cate[val + nr] == 0) s.insert(val + nr); cate[val + nr] += cate[val]; } if (cate[nr] == 0) s.insert(nr); cate[nr]++; } ll ans = 0; for (auto it : cate) ans += it.second; cout << ans + 1; return 0; }
#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...