제출 #397620

#제출 시각아이디문제언어결과실행 시간메모리
397620huukhang은행 (IZhO14_bank)C++11
컴파일 에러
0 ms0 KiB
/* Khangnh's code “You can either experience the pain of discipline or the pain of regret. The choice is yours.” */ // - Only when necessary :d // #pragma GCC optimize("Ofast") // #pragma GCC optimize("unroll-loops") // #pragma GCC target("avx,avx2,fma") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define fileopen(a, b) freopen(((string)a + ".inp").c_str(), "r", stdin); freopen(((string)b + ".out").c_str(), "w", stdout); #define ll long long // #define int long long #define fi first #define se second #define pb push_back #define pf push_front #define pob pop_back #define pof pop_front typedef pair<int, int> pii; typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; const ll mod = 1e9 + 7; const ll inf = 1e9 + 7; const double eps = 1e-9; int n, m; int a[20], b[20]; pii dp[1 << 20]; void solve() { cin >> n >> m; for (int i = 0; i < n; ++i) cin >> a[i]; for (int i = 0; i < m; ++i) cin >> b[i]; for (int i = 1; i < n; ++i) a[i] += a[i - 1]; for (int i = 0; i < (1 << m); ++i) { dp[i] = {0, 0}; for (int j = 0; j < m; ++j) { if ((i >> j) & 1) { pii tmp = dp[i ^ (1 << j)]; if (tmp.se + b[j] < a[tmp.fi]) tmp.se += b[j]; else if (tmp.se + b[j] == a[tmp.fi].fi) ++tmp.fi, tmp.se = 0; dp[i] = min(dp[i], tmp); } } if (dp[i].first == n) { cout << "YES"; return; } } cout << "NO"; } signed main() { #ifdef khangorz fileopen("input", "output"); #endif #ifndef khangorz // fileopen("LAH", "LAH"); #endif ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); solve(); return 0; }

컴파일 시 표준 에러 (stderr) 메시지

bank.cpp: In function 'void solve()':
bank.cpp:23:12: error: request for member 'first' in 'a[tmp.std::pair<int, int>::first]', which is of non-class type 'int'
   23 | #define fi first
      |            ^~~~~
bank.cpp:54:41: note: in expansion of macro 'fi'
   54 |     else if (tmp.se + b[j] == a[tmp.fi].fi) ++tmp.fi, tmp.se = 0;
      |                                         ^~