Submission #595584

#TimeUsernameProblemLanguageResultExecution timeMemory
595584ThegeekKnight16Uplifting Excursion (BOI22_vault)C++14
0 / 100
5059 ms25344 KiB
#include <bits/stdc++.h> using namespace std; typedef long long int ll; map<ll, ll> dp; ll border = 2e5 + 10; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ll M, L; cin >> M >> L; for (ll i = -M; i <= M; i++) { ll A; cin >> A; int c = 1; if (i < 0) c = -1; //cerr << c << '\n'; for (int t = c*border; abs(t) <= border; t -= c) { for (ll k = 1; k <= A; k++) dp[t] = max(dp[t], dp[t - (i * k)] + k); } } if (dp[L] == 0) cout << "impossible"; else cout << dp[L]; }
#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...