Submission #967710

#TimeUsernameProblemLanguageResultExecution timeMemory
967710vjudge1Ice Hockey World Championship (CEOI15_bobek)C++17
10 / 100
43 ms2652 KiB
#include <bits/stdc++.h> using namespace std; #define int long long signed main() { cin.tie(nullptr)->sync_with_stdio(false); int n, k; cin >> n >> k; vector<int> arr(n); for(int i = 0; i < n; ++i) cin >> arr[i]; vector<vector<bool>> dp(n + 1, vector<bool>(k + 1, false)); dp[0][0] = true; for(int i = 1; i <= n; ++i) { for(int j = 0; j <= k; ++j) { dp[i][j] = dp[i - 1][j] || (j >= arr[i - 1] && dp[i - 1][j - arr[i - 1]]); } } int ans = 0; for(int j = 0; j <= k; ++j) { if(dp[n][j]) ans++; } cout << ans; 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...