Submission #595564

#TimeUsernameProblemLanguageResultExecution timeMemory
595564ThegeekKnight16Uplifting Excursion (BOI22_vault)C++14
0 / 100
5040 ms524288 KiB
#include <bits/stdc++.h> using namespace std; set<pair<long long int, long long int> > Valores; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long int M, L; cin >> M >> L; Valores.insert(make_pair(0LL, 0LL)); for (long long int i = -M; i <= M; i++) { long long int A; cin >> A; set<pair<long long int, long long int> > Novo; for (auto val : Valores) { for (long long int k = 1; k <= A; k++) Novo.insert(make_pair(val.first + k*i, val.second + k)); } for (auto newVal : Novo) Valores.insert(newVal); } long long int resp = -1; for (auto val : Valores) { if (val.first == L) resp = max(resp, val.second); } if (resp == -1) cout << "impossible"; else cout << resp; }
#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...