Submission #899417

#TimeUsernameProblemLanguageResultExecution timeMemory
899417nasir_bashirovBank (IZhO14_bank)C++11
25 / 100
1097 ms416 KiB
#pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #include <bits/stdc++.h> using namespace std; #define db long double #define ll long long #define pii pair<int, int> #define pll pair<ll, ll> #define vi vector<int> #define vl vector<ll> #define vii vector<pii> #define vll vector<pll> #define endl '\n' #define all(x) x.begin(), x.end() #define fastio\ ios_base::sync_with_stdio(0);\ cin.tie(0);\ cout.tie(0)\ #define int long long int a[25], b[25], n, m; signed main(){ cin >> n >> m; for(int i = 1; i <= n; i++){ cin >> a[i]; } vi v; for(int i = 1; i <= m; i++){ cin >> b[i]; v.push_back(i); } do{ int p = 1, cur = 0, s = 0; while(p <= n and cur < v.size()){ s += b[v[cur]]; cur++; if(s == a[p]) p++, s = 0; } if(p == n + 1){ cout << "YES"; return 0; } }while(next_permutation(all(v))); cout << "NO"; }

Compilation message (stderr)

bank.cpp: In function 'int main()':
bank.cpp:38:30: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |         while(p <= n and cur < v.size()){
      |                          ~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...