답안 #928765

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
928765 2024-02-17T05:14:13 Z Sir_Ahmed_Imran Kitchen (BOI19_kitchen) C++17
29 / 100
199 ms 21592 KB
                              ///~~~LOTA~~~///
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define append push_back
#define add insert
#define nl "\n"
#define ff first
#define ss second
#define pii pair<int,int>
#define all(x) (x).begin(),(x).end()
#define L0TA ios_base::sync_with_stdio(false);cin.tie(NULL)
#define N 90001
bitset<N> dp[N];
void solve(){
    int n,m,o,p,q,r;
    cin>>n>>m>>o;
    for(int i=0;i<=n*o;i++)
        dp[i].reset();
    dp[0][0]=1;
    r=0;
    for(int i=0;i<n;i++){
        cin>>p;
        r+=p;
        if(p<o){
            cout<<"Impossible";
            return;
        }
    }
    r-=n*o;
    for(int i=0;i<m;i++){
        cin>>p;
        q=max(o,p-n);
        p-=q;
        for(int j=n*o;j>=0;j--)
            dp[min(j+p,n*o)]|=(dp[j]<<(q+max(0,p+j-n*o)));
    }
    for(int i=0;r+i<N;i++){
        if(dp[n*o][r+i]){
            cout<<i;
            return;
        }
    }
    cout<<"Impossible";
}
int main(){
    L0TA;
    solve();
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 2708 KB Output is correct
5 Correct 2 ms 4700 KB Output is correct
6 Correct 1 ms 2652 KB Output is correct
7 Correct 1 ms 2652 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 2708 KB Output is correct
5 Correct 2 ms 4700 KB Output is correct
6 Correct 1 ms 2652 KB Output is correct
7 Correct 1 ms 2652 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 3 ms 2648 KB Output is correct
10 Correct 2 ms 2648 KB Output is correct
11 Runtime error 23 ms 9052 KB Execution killed with signal 11
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 178 ms 4696 KB Output is correct
2 Correct 146 ms 4696 KB Output is correct
3 Correct 199 ms 4948 KB Output is correct
4 Correct 183 ms 4740 KB Output is correct
5 Correct 188 ms 4740 KB Output is correct
6 Correct 144 ms 4700 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 38 ms 21592 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 2708 KB Output is correct
5 Correct 2 ms 4700 KB Output is correct
6 Correct 1 ms 2652 KB Output is correct
7 Correct 1 ms 2652 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 3 ms 2648 KB Output is correct
10 Correct 2 ms 2648 KB Output is correct
11 Runtime error 23 ms 9052 KB Execution killed with signal 11
12 Halted 0 ms 0 KB -