Submission #968034

#TimeUsernameProblemLanguageResultExecution timeMemory
968034vjudge1Ice Hockey World Championship (CEOI15_bobek)C++17
40 / 100
1065 ms600 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long ll n,m; ll solve(vector<ll> pr,ll curr,ll pos) { if (curr == 0) { return 1; } ll c=1; for (int i=pos+1;i<n;i++) { if (curr-pr[i] >= 0) { c+=solve(pr,curr-pr[i],i); } else { return c; } } return c; } int main() { cin.tie(0)->sync_with_stdio(false); cin >> n >> m; vector<ll> pr(n); for (int i=0;i<n;i++) { cin >> pr[i]; } sort(pr.begin(),pr.end()); while (pr.back() > m) { pr.pop_back(); n--; } cout << solve(pr,m,-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...