Submission #590351

#TimeUsernameProblemLanguageResultExecution timeMemory
590351tutisUplifting Excursion (BOI22_vault)C++17
0 / 100
5086 ms47960 KiB
/*input 1 5 0 0 6 */ #include <bits/stdc++.h> using namespace std; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); using ll = long long; using ull = unsigned long long; using ld = long double; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int M; ll L; cin >> M >> L; ll A[2 * M + 1]; for (int i = 0; i <= 2 * M; i++) cin >> A[i]; map<ll, int>C; C[0] = 0; for (int i = -M; i <= M; i++) { map<ll, int>C1 = C; for (int k = 1; k <= A[i + M]; k++) { for (auto v : C) { C1[v.first + k * i] = max(C1[v.first + k * i], v.second + k); } } C = C1; } if (C.count(L)) cout << C[L] << "\n"; else cout << "impossible\n"; }
#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...