제출 #1318955

#제출 시각아이디문제언어결과실행 시간메모리
1318955hansen은행 (IZhO14_bank)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define fi first #define se second #define test(v) \ for (auto &x : (v)) { \ cout << x << " "; \ } \ cout << "\n"; #define test2d(v) \ for (int i = 0; i < (int)v.size(); i++) { \ for (int j = 0; j < (int)v[i].size(); j++) { \ cout << v[i][j] << " "; \ } \ cout << '\n'; \ } #define pb push_back vector<pair<int, int>> dirs = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}}; mt19937 rng((int)chrono::steady_clock::now().time_since_epoch().count()); int hashp = uniform_int_distribution<int>(10, 1e9)(rng); int hashm1 = 1e9+7; int hashm2 = 1e9+9; int MOD = 1e9+7; int MV = 1e18; void solve(){ int n, m; cin >> n >> m; vector<int> a(n), b(m); for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < m; i++) cin >> b[i]; sort(a.begin(), a.end()); vector<array<int, 2>> dp(1 << m, {-1, -1}); dp[0] = {0, 0}; for (int i = 0; i < (1 << m); i++) { if (dp[i][0] == -1) continue; for (int j = 0; j < m; j++) { if (!(i & (1 << j))) { int nm = i | (1 << j); int cov = dp[i].first; int rem = dp[i].second; if (cov == n) { dp[nm] = max(dp[nm], {cov, rem}); continue; } if (rem + b[j] < a[cov]) { dp[nm] = max(dp[nm], {cov, rem + b[j]}); } else if (rem + b[j] == a[cov]) { dp[nm] = max(dp[nm], {cov + 1, 0LL}); } } } } if (dp[(1 << m)-1][0] == n && dp[(1 << m)-1][1] >= 0) { cout << "YES"; } else { cout << "NO"; } } signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); /* freopen("pcb.in", "r", stdin); freopen("pcb.out", "w", stdout); */ solve(); return 0; }

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

bank.cpp: In function 'void solve()':
bank.cpp:41:33: error: '__gnu_cxx::__alloc_traits<std::allocator<std::array<long long int, 2> >, std::array<long long int, 2> >::value_type' {aka 'struct std::array<long long int, 2>'} has no member named 'first'
   41 |                 int cov = dp[i].first;
      |                                 ^~~~~
bank.cpp:42:33: error: '__gnu_cxx::__alloc_traits<std::allocator<std::array<long long int, 2> >, std::array<long long int, 2> >::value_type' {aka 'struct std::array<long long int, 2>'} has no member named 'second'
   42 |                 int rem = dp[i].second;
      |                                 ^~~~~~