Submission #1107538

#TimeUsernameProblemLanguageResultExecution timeMemory
1107538vjudge1Bank (IZhO14_bank)C++17
19 / 100
70 ms15432 KiB
#include <bits/stdc++.h> #define speed ios_base::sync_with_stdio(0), cin.tie(0) #define int long long #define st first #define nd second #define pb push_back #define love our_kolhoz using namespace std; const int N = 1e5 + 10, inf = 1e18, mod = 1e9 + 7; //koz qorqaq int n, m; vector<int> g[N]; int a[N]; bool kek(int mask, int i) { if (i == n - 1) { for (auto to : g[a[i]]) { if ((mask & (to)) == 0) { return 1; } } return 0; } for (auto to : g[a[i]]) { if ((mask & (to)) == 0) { kek((mask & (to)), i + 1); } } return 0; } void solve() { cin >> n >> m; int b[m]; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < m; i++) cin >> b[i]; for (int i = 0; i < (1 << m); i++) { int lol = 0; for (int j = 0; j < m; j++) { if (i & (1 << j)) { lol += b[j]; } } //cout << lol << ' ' << i << ' ' << '\n'; g[lol].pb(i); } /*for (int i = 0; i < n; i++) { cout << a[i] << ':'; for (int j = 0; j < g[a[i]].size(); j++) { cout << g[a[i]][j] << ' '; } cout << '\n'; }*/ if (n == 1) { cout << (g[a[0]].size() > 0 ? "YES\n" : "NO\n"); return; } for (int i = 0; i < g[a[0]].size(); i++) { if (kek(g[a[0]][i], 1)) { cout << "YES\n"; return; } } cout << "NO\n"; } signed main() { speed; //freopen("points.in ", "r", stdin); //freopen("points.out", "w", stdout); int _t = 1; //cin >> _t; while (_t--) solve(); return 0; } // sau bol // there's really no way of winning // if in their eyes you'll always be a dumb blonde...

Compilation message (stderr)

bank.cpp: In function 'void solve()':
bank.cpp:71:23: 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]
   71 |     for (int i = 0; i < g[a[0]].size(); 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...