Submission #1109965

#TimeUsernameProblemLanguageResultExecution timeMemory
1109965DON_FBank (IZhO14_bank)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; using i64 = long long; #define all(x) x.begin(), x.end() #define L(i, b, e) for (int i = b; i < e; ++i) #define R(i, b, e) for (int i = b; i >= e; --i) #define pb emplace_back #define vi vector<int> #define sz(x) ((int) x.size()) int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int n, m; cin >> n >> m; vi a(n), b(m); L(i, 0, n)cin >> a[i]; L(i, 0, m)cin >> b[i]; vector<pair<int, int>> dp(1 << m, {-1, -1}); dp[0] = {0, 0}; L(i, 0, 1 << m){ L(j, 0, m){ if ((1 << j) & i || dp[i].first == -1)continue; if (dp[i].second < n && dp[i].first + b[j] <= a[dp[i].second]){ dp[i + (1 << j)] = {(dp[i].first + b[j] == a[dp[i].second] ? 0 : dp[i].first + b[j]), (dp[i].first + b[j] == a[dp[i].second] ? dp[i].second + 1 : dp[i].second)}; } } } int ans = 0; L(i, 0, 1 << m)if (dp[i].second == n)ans = 1;2 6 cout << (ans ? "YES\n" : "NO\n"); }

Compilation message (stderr)

bank.cpp: In function 'int main()':
bank.cpp:5:20: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
    5 | #define L(i, b, e) for (int i = b; i < e; ++i)
      |                    ^~~
bank.cpp:29:5: note: in expansion of macro 'L'
   29 |     L(i, 0, 1 << m)if (dp[i].second == n)ans = 1;2 6
      |     ^
bank.cpp:29:50: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   29 |     L(i, 0, 1 << m)if (dp[i].second == n)ans = 1;2 6
      |                                                  ^
bank.cpp:29:51: error: expected ';' before numeric constant
   29 |     L(i, 0, 1 << m)if (dp[i].second == n)ans = 1;2 6
      |                                                   ^~
      |                                                   ;
bank.cpp:29:50: warning: statement has no effect [-Wunused-value]
   29 |     L(i, 0, 1 << m)if (dp[i].second == n)ans = 1;2 6
      |                                                  ^