제출 #1106949

#제출 시각아이디문제언어결과실행 시간메모리
1106949vjudge1은행 (IZhO14_bank)C++17
19 / 100
69 ms504 KiB
/********************************** //deque,priority_queue * author: NurkhatKrutoi2009 * created: Just now * P.S: tourist ne katai **********************************/ #include <bits/stdc++.h> /* #include <algorithm> #include <iostream> #include <cmath> *//* #pragma GCC optimize("fast-loops") #pragma comment(linker, "/stack:200000000") #pragma GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native,avx2,fma") #pragma GCC optimization ("unroll-loops") */ #define int long long #define FREOPEN freopen("rvq.in", "r", stdin); freopen("rvq.out", "w", stdout); #define sonic ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define FORR( i, x, n, d ) for( int i = x; i >= n; i -= d ) #define FOR( i, x, n, d ) for( int i = x; i <= n; i += d ) #define all(x) (x).begin(), (x).end() #define pss pair<string,string> #define nextp next_permutation #define pii pair<int,int> #define priq priority_queue #define mii map<int,int> #define sz(x) (x).size() #define str to_string #define rev reverse #define pb push_back #define ll long long #define endl '\n' #define S second #define F first const int Pi=3.1415926535; const int inf=1e10+5; const int MOD=1e9+7; const int N=1e5+123; const int lol=63; using namespace std; int tc=1; int n,m; int s[25]; int v[25]; void code( ){ cin>>n>>m; FOR(i,1,n,1)cin>>s[i]; FOR(i,1,m,1)cin>>v[i]; if(m<n){ cout<<"NO";return; } if(m==n){ sort(v+1,v+m+1); sort(s+1,s+n+1); FOR(i,1,n,1){ if(v[i]!=s[i]){ cout<<"NO";return; } }cout<<"YES";return;} if(n==1){ for(int mask=0;mask<(1<<m);mask++){ int sum=0; for(int i=0;i<m;i++)if(mask & (1<<i))sum+=v[i+1]; if(sum==s[1]){ cout<<"YES";return; } }cout<<"NO"; return;} }signed main(){sonic //FREOPEN //cin>>tc; while(tc--){ code(); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...