Submission #958142

# Submission time Handle Problem Language Result Execution time Memory
958142 2024-04-05T02:38:11 Z ezzzay Kitchen (BOI19_kitchen) C++14
Compilation error
0 ms 0 KB
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<map>
#include<string>
#include<algorithm>
#include<vector>
#include<string.h>
#include<utility>
#include<set>
#include<cmath>
#include<queue>
#include<deque>
#include<functional>
#include<stack>
#include<limits.h>
#include<iomanip>
#include<unordered_map> 
#include<numeric>
#include<tuple>
#include<bitset>
using namespace std;
 
#define MOD 1000000007
#define int long long
#define ss second
#define ff first
#define endl '\n'
typedef pair<int,int> pp;
const int mxN=9e4+1;
vector<bool> dp(mxN);
signed main(){
    // freopen("file.in", "r", stdin);
    // freopen("file.out", "w", stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
 
	int n,m,k; cin>>n>>m>>k;
	vector<int> a(n),b(m);
	for(int i=0; i<n; i++) cin>>a[i];
	for(int i=0; i<m; i++) cin>>b[i];  
	int sum=0;
	for(int i=0; i<n; i++){
		sum+=a[i];
		if(a[i]<k){
			cout<<"Impossible";
			return 0;
		}
	}
		int ans=1e9;
		for(int i=0; i<(1<<m); i++){
			int cur=0,cnt=0,num=0;
			for(int j=0; j<m; j++){
				if(i&(1<<j)){
					if(num+b[j]>=n){
						cnt++;
						num=min(num,(num+b[j])%n);
					}else{
						num+=b[j];
					}
					cur+=b[j];
				}
			}
			if(cur>=sum&&cnt>=k){
				ans=min(ans,cur-sum);
			}
		}
		if(ans==1e9) cout<<"Impossible";
		else cout<<ans;
	}
    return 0;
}
 
 
 
 
 
 
 
 
 
 

Compilation message

kitchen.cpp:72:5: error: expected unqualified-id before 'return'
   72 |     return 0;
      |     ^~~~~~
kitchen.cpp:73:1: error: expected declaration before '}' token
   73 | }
      | ^