제출 #1089137

#제출 시각아이디문제언어결과실행 시간메모리
1089137vjudge1은행 (IZhO14_bank)C++17
19 / 100
60 ms460 KiB
//don't copy pls) /*TAAK ZDES NADO RECURSIU PISAT*/ //I'm not in the danger i am the DANGER #include "bits/stdc++.h" #include <ext/pb_ds/assoc_container.hpp> #define ll long long #define pb push_back #define int long long #define F first #define S second #define all(x) (x).begin(), (x).end() #define pii pair<int,int> #define sigma signed using namespace std; using namespace __gnu_pbds; const int N = 1e3 + 5; int mod = 1e9 + 7; const int INF = 1e18; int n,m,a[N],b[N],dp[N][N],c[N]; void Gold(){ cin >> n >> m; for(int i = 1 ; i <= n ; i++){ cin >> a[i]; } for(int i = 1 ; i <= m ; i++){ cin >> b[i]; } if(n == 1){ int x = a[1]; string ans = "NO"; for(int mask = 0 ; mask < (1 << m) ; mask++){ int sum = 0; for(int i = 1 ; i <= m ; i++){ if(((mask >> (i - 1)) & 1)){ sum += b[i]; // cout << i << ' '; } } // cout << '\n'; // cout << sum << '\n'; if(sum == x){ ans = "YES"; break; } } cout << ans; } } sigma main(){ //freopen("txt.in","r",stdin); //freopen("txt.out","w",stdout); ios_base::sync_with_stdio(0); cin.tie(0); srand(time(0)); int TT = 1; // cin >> TT; for(int i = 1 ; i <= TT ; i++){ //cout << "Case " << i << ": "; Gold(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...