Submission #124127

#TimeUsernameProblemLanguageResultExecution timeMemory
124127RafikHachanaIce Hockey World Championship (CEOI15_bobek)C++14
20 / 100
1081 ms66880 KiB
#include<bits/stdc++.h> using namespace std; #define int long long int n; vector<int> v; map<pair<int,int>,int> m; int dp(int i,int rem) { if(rem<0) return 0; if(i==n) return 1; if(m.find({i,rem})!=m.end()) return m[{i,rem}]; return m[{i,rem}] = dp(i+1,rem) + dp(i+1,rem-v[i]); } main() { cin>>n; int w; cin>>w; v.resize(n); for(int i=0;i<n;i++) cin>>v[i]; cout<<dp(0,w)<<endl; }

Compilation message (stderr)

bobek.cpp:18:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main()
      ^
#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...