답안 #1038579

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1038579 2024-07-30T02:25:08 Z 12345678 Uplifting Excursion (BOI22_vault) C++17
0 / 100
75 ms 16472 KB
#include <bits/stdc++.h>

using namespace std;

const int nx=2e6+5, c=1e6;

int m, a[nx], z, p[nx], n[nx], dp[nx], l;

int main()
{
    cin.tie(NULL)->sync_with_stdio(false);
    cin>>m>>l;
    for (int i=m; i>=1; i--) cin>>n[i];
    cin>>z;
    for (int i=1; i<=m; i++) cin>>p[i];
    for (int i=0; i<nx; i++) dp[i]=-1;
    dp[c]=0;
    for (int i=1; i<=m; i++)
    {
        for (int t=0; t<n[i]; t++) for (int j=0; j<nx; j++) if (j+i<nx&&dp[j+i]!=-1) dp[j]=max(dp[j], dp[j+i]+1);
    }
    for (int i=1; i<=m; i++)
    {
        for (int t=0; t<p[i]; t++) for (int j=nx; j>=0; j--) if (j+i<nx&&dp[j-i]!=-1) dp[j]=max(dp[j], dp[j-i]+1);
    }
    if (dp[l+c]==-1) cout<<"imposslble";
    else cout<<dp[l+c]+z;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 8284 KB Output is correct
2 Incorrect 11 ms 8284 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 8284 KB Output is correct
2 Incorrect 11 ms 8284 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 75 ms 8288 KB Output is correct
2 Runtime error 9 ms 16472 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 75 ms 8288 KB Output is correct
2 Runtime error 9 ms 16472 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 75 ms 8288 KB Output is correct
2 Runtime error 9 ms 16472 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 8284 KB Output is correct
2 Incorrect 11 ms 8284 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 75 ms 8288 KB Output is correct
2 Runtime error 9 ms 16472 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 8284 KB Output is correct
2 Incorrect 11 ms 8284 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 75 ms 8288 KB Output is correct
2 Runtime error 9 ms 16472 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 8284 KB Output is correct
2 Incorrect 11 ms 8284 KB Output isn't correct
3 Halted 0 ms 0 KB -