Submission #967989

#TimeUsernameProblemLanguageResultExecution timeMemory
967989vjudge1Ice Hockey World Championship (CEOI15_bobek)C++17
20 / 100
1060 ms77584 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long ll n,m; unordered_set<string> st; ll solve(vector<ll> pr,ll curr,string vis) { if (curr < 0) { return 0; } if (st.find(vis) != st.end()) { return 0; } st.insert(vis); ll c=1; for (int i=0;i<n;i++) { if (vis[i] == '0') { vis[i] = '1'; c+=solve(pr,curr-pr[i],vis); vis[i]= '0'; } } 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]; } cout << solve(pr,m,string(n,'0')); 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...