Submission #108922

#TimeUsernameProblemLanguageResultExecution timeMemory
108922bibabasBank (IZhO14_bank)C++14
0 / 100
1082 ms1152 KiB
#ifdef LOCAL #define _GLIBCXX_DEBUG #endif #include <bits/stdc++.h> #define ll long long #define vi vector<int> #define vvi vector<vi> #define all(x) x.begin(), x.end() #define pb push_back #define mp make_pair int INF = (int)2e9; using namespace std; template <class T> istream& operator >>(istream &in, vector<T> &arr) { for (T &cnt : arr) { in >> cnt; } return in; }; void solve() { unsigned int n, m; cin >> n >> m; vi a(n), b(m); cin >> a >> b; vi used((int)2e5 + 1, 0); for (int i = 0; i < 1 << m; ++i){ int sum = 0; for (int j = 0; j < m; ++j){ if (i & (1 << j)){ sum += b[j]; used[sum] = 1; } } sum = 0; int ans = 0; for (int j = 0; j < n; ++j){ sum += a[j]; if (used[sum]) ans++; } if (ans == n){ cout << "YES"; return; } used.assign((int)2e5 + 1, 0); } cout << "NO"; } int main() { #ifdef LOCAL freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #else ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); #endif solve(); return 0; }

Compilation message (stderr)

bank.cpp: In function 'void solve()':
bank.cpp:30:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int j = 0; j < m; ++j){
                         ~~^~~
bank.cpp:38:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int j = 0; j < n; ++j){
                         ~~^~~
bank.cpp:43:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (ans == n){
             ~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...