제출 #1128170

#제출 시각아이디문제언어결과실행 시간메모리
1128170ImperialALEN은행 (IZhO14_bank)C++20
0 / 100
0 ms328 KiB
// #pragma GCC optomize ("Ofast") // #pragma GCC optomize ("unroll-loops") // #pragma GCC target ("avx,avx2,fma") #include <bits/stdc++.h> #define F first #define S second #define ll long long #define int long long #define pb push_back #define all(x) (x.begin(),x.end()) #define ios ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); using namespace std; const ll N = 2e5+9, INF = 1e18 , inf = 1e9 , mod = 1e9+7; int a[22]; int b[22]; int dp[N]; signed main(){ // freopen("bank.in", "r", stdin); // freopen("bank.out", "w", stdout); ios; int n,m; cin>>n>>m; for(int i=1;i<=n;i++)cin>>a[i]; int x=0; for(int i=1;i<=m;i++){ cin>>b[i]; x+=b[i]; } if(n==1){ for(int pos=x;pos>=1;pos--){ for(int i=1;i<=m;i++){ if(pos-b[i]>=0)dp[pos]=max(dp[pos],dp[pos-b[i]]+1); } } if(dp[a[1]]!=0)cout<<"YES\n"; else cout<<"NO\n"; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...