Submission #758752

# Submission time Handle Problem Language Result Execution time Memory
758752 2023-06-15T08:50:30 Z Hanksburger Kitchen (BOI19_kitchen) C++17
20 / 100
16 ms 680 KB
#include <bits/stdc++.h>
using namespace std;
int a[305], b[305], dp[90005];
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, m, k, sum=0;
    cin >> n >> m >> k;
    for (int i=1; i<=n; i++)
    {
        cin >> a[i];
        sum+=a[i];
    }
    dp[0]=1;
    for (int i=1; i<=m; i++)
    {
        cin >> b[i];
        for (int j=90000; j>=b[i]; j--)
            dp[j]+=dp[j-b[i]];
    }
    for (int i=sum; i<=90000; i++)
    {
        if (dp[i])
        {
            cout << i-sum;
            return 0;
        }
    }
    cout << "Impossible";
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 596 KB Output is correct
2 Correct 1 ms 596 KB Output is correct
3 Correct 1 ms 596 KB Output is correct
4 Incorrect 1 ms 596 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 596 KB Output is correct
2 Correct 1 ms 596 KB Output is correct
3 Correct 1 ms 596 KB Output is correct
4 Incorrect 1 ms 596 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 11 ms 596 KB Output is correct
2 Correct 10 ms 680 KB Output is correct
3 Correct 12 ms 680 KB Output is correct
4 Correct 14 ms 680 KB Output is correct
5 Correct 16 ms 596 KB Output is correct
6 Correct 12 ms 680 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 596 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 596 KB Output is correct
2 Correct 1 ms 596 KB Output is correct
3 Correct 1 ms 596 KB Output is correct
4 Incorrect 1 ms 596 KB Output isn't correct
5 Halted 0 ms 0 KB -