Submission #90902

#TimeUsernameProblemLanguageResultExecution timeMemory
90902RAkhshonBank (IZhO14_bank)C++14
25 / 100
1087 ms608 KiB
#include<bits/stdc++.h> #define ll long long #define ld long double #define st string #define fr first #define se second #define INF 1000000000 using namespace std; ll a[101101], b[101101], dp[101101]; int main() { ll n, m; scanf("%lld %lld", &n, &m); ll s; for(ll i = 1; i <= n; i ++){ scanf("%lld", &a[i]); } for(ll i = 1; i <= m; i ++){ scanf("%lld", &b[i]); } sort(a+1,a+1+n); sort(b+1,b+1+m); do{ ll sum = 0, num = 1; for(ll i = 1; i <= m; i ++){ sum=sum+b[i]; if(num == n + 1) break; if(sum > a[num]) break; if(sum == a[num]) sum=0,num++; } if(num == n+1){ printf("YES"); return 0; } }while(next_permutation(b+1,b+1+m)); printf("NO"); return 0; }

Compilation message (stderr)

bank.cpp: In function 'int main()':
bank.cpp:14:8: warning: unused variable 's' [-Wunused-variable]
     ll s;
        ^
bank.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld %lld", &n, &m);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~
bank.cpp:16:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld", &a[i]);
         ~~~~~^~~~~~~~~~~~~~~
bank.cpp:19:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld", &b[i]);
         ~~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...