답안 #514902

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
514902 2022-01-18T18:39:20 Z Mahdi Kitchen (BOI19_kitchen) C++17
20 / 100
2 ms 340 KB
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
#define all(v) v.begin(), v.end()
#define F first
#define S second
typedef long long ll;
typedef pair<int, int> pii;
const int N=305;
int n, m, k, a[N], b[N], c[N*N];
bitset<N*N>e;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin>>n>>m>>k;
    for(int i=0;i<n;++i)
        cin>>a[i];
    int z=0;
    for(int i=0;i<m;++i){
        cin>>b[i];
        z+=b[i];
    }
    e.set(0);
    for(int i=0;i<m;++i)
        e|=(e<<b[i]);
    int x=0;
    for(int i=0;i<n;++i)
        x+=a[i];
    for(int i=x;i<=z;++i){
        if(e.test(i)){
            cout<<i-x;
            return 0;
        }
    }
    cout<<"Impossible";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 0 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Incorrect 1 ms 332 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 0 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Incorrect 1 ms 332 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 2 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 0 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Incorrect 1 ms 332 KB Output isn't correct
5 Halted 0 ms 0 KB -