# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
577714 | patrikpavic2 | Uplifting Excursion (BOI22_vault) | C++17 | 342 ms | 596 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long ll;
const int M = 305;
const int INF = 0x3f3f3f3f;
int m;
ll L, A[M], kol;
int dp[M * M];
int main(){
scanf("%d%lld", &m, &L);
for(int i = m;i >= 1;i--){
ll x; scanf("%lld", &x);
// A[i] += x; L += x * i;
}
ll bla; scanf("%lld", &bla);
for(int i = 1;i <= m;i++){
ll x; scanf("%lld", &x);
A[i] += x;
}
for(int i = 1;i <= m;i++){
ll ost = min((ll)M, A[i]);
ll uz = min(A[i] - ost, max(L - (M * M - 5 * M), 0LL) / i);
kol += uz; L -= uz * i;
A[i] = ost;
}
for(int i = 1;i < M * M;i++)
dp[i] = -INF;
for(int i = 1;i <= m;i++){
for(int j = 0;j < A[i];j++){
for(int k = M * M - 1;k >= i;k--)
dp[k] = max(dp[k], 1 + dp[k - i]);
}
}
if(L >= M * M || dp[L] < 0)
printf("impossible\n");
else
printf("%lld\n", kol + dp[L] + bla);
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |