Submission #743697

# Submission time Handle Problem Language Result Execution time Memory
743697 2023-05-17T17:54:12 Z Dead_Inside7 Bank (IZhO14_bank) C++17
0 / 100
1 ms 468 KB
#include <bits/stdc++.h>
using namespace std;
int main() {
	// ifstream cin("bank.in");
	// ofstream cout("bank.out");
	int n,m;
	cin>>n>>m;
	vector<int> a(n),b(m);
	for(auto&v:a) cin>>v;
	for(auto&v:b) cin>>v;
	bool cc=false;
	vector<pair<long long,long long>> dp(1<<m,{0,0});
    for(int i=1;i<(1<<m);i++){
	    for(int j=0;j<m;j++){
			if(i&(1<<j)){
				pair<long long,long long> mx;
				mx=dp[i^(1<<j)];
				mx.second += b[j];
				if(a[mx.first] == mx.second){
					mx.second=0;
					mx.first++;
					if(mx >= dp[i]) dp[i]=mx;
				}
			}
		}
		if(dp[i].first == n){
			cc=true;break;
		}
	}
	if(cc) cout<<"Yes";
	else cout<<"No";
	 return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 468 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -