Submission #870799

#TimeUsernameProblemLanguageResultExecution timeMemory
870799NurislamBank (IZhO14_bank)C++14
19 / 100
252 ms432 KiB
#include <bits/stdc++.h> using namespace std;/* <<<<It's never too late for a new beginning in your life>>>> Today is hard tomorrow will worse but the day after tomorrow will be the sunshine.. HARD WORK BEATS TALENT WHEN TALENT DOESN'T WORK HARD............ Never give up */ //The most CHALISHKANCHIK #define ios ios_base::sync_with_stdio(false);cin.tie(NULL); #define endl '\n' #define ff first #define ss second #define all(x) x.begin(),x.end() #define rall(x) x.rbegin(),x.rend() #define pb push_back #define rew(i, a, b) for(int i = a; i < b; i++) #define wer(i, a, b) for(int i = b - 1; i >= a; i--) #define int long long typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pii> vii; void solve(){ int n, m; cin >> n >> m; int a[n]; multiset<int> st; for(int &i:a)cin >> i; rew(i, 0, m){int x;cin >> x;st.insert(x);} for(int i = 0; i < n; i++){ int f = 1; for(int ms = 0; ms < (int)(1 << st.size()); ms++){ vi res; int cnt = 0, sum = 0; for(int j:st){ if((ms >> cnt) & 1){ sum+=j; res.pb(j); } cnt++; } if(sum == a[i]){ for(int i:res){ st.erase(st.find(i)); } f = 0; break; } } if(f){ cout << "NO" << endl; return; } } cout << "YES" << endl; } main(){ ios int t = 1; //~ cin >> t; while(t--){ solve(); } }

Compilation message (stderr)

bank.cpp:60:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   60 | main(){
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...