Submission #888754

# Submission time Handle Problem Language Result Execution time Memory
888754 2023-12-18T07:19:12 Z 12345678 Kitchen (BOI19_kitchen) C++17
20 / 100
13 ms 824 KB
#include <bits/stdc++.h>

using namespace std;

const int nx=305;
int n, m, k, sm, x, dp[nx*nx];

int main()
{
    cin.tie(NULL)->sync_with_stdio(false);
    cin>>n>>m>>k;
    for (int i=1; i<=n; i++) cin>>x, sm+=x;
    dp[0]=1;
    for (int i=1; i<=m; i++)
    {
        cin>>x;
        for (int j=nx*nx-x-1; j>=0; j--) dp[j+x]|=dp[j];
    }
    for (int i=sm; i<nx*nx; i++)
    {
        if (dp[i])
        {
            cout<<i-sm;
            return 0;
        }
    }
    cout<<"Impossible";
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 604 KB Output is correct
2 Correct 1 ms 604 KB Output is correct
3 Correct 1 ms 600 KB Output is correct
4 Incorrect 1 ms 604 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 604 KB Output is correct
2 Correct 1 ms 604 KB Output is correct
3 Correct 1 ms 600 KB Output is correct
4 Incorrect 1 ms 604 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 11 ms 604 KB Output is correct
2 Correct 10 ms 604 KB Output is correct
3 Correct 13 ms 820 KB Output is correct
4 Correct 13 ms 824 KB Output is correct
5 Correct 12 ms 824 KB Output is correct
6 Correct 9 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 604 KB Output is correct
2 Correct 1 ms 604 KB Output is correct
3 Correct 1 ms 600 KB Output is correct
4 Incorrect 1 ms 604 KB Output isn't correct
5 Halted 0 ms 0 KB -