제출 #1017103

#제출 시각아이디문제언어결과실행 시간메모리
1017103daviedu은행 (IZhO14_bank)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define fastio ios_base::sync_with_stdio(0); cin.tie(0) #define all(a) a.begin(), a.end() #define rall(a) a.rbegin(), a.rend() #define ll long long struct P{ ll x, y; }; void dbg_out() { cerr << endl; } template <typename H, typename... T> void dbg_out(H h, T... t) { cerr << ' ' << h; dbg_out(t...); } #define dbg(...) { cerr << #__VA_ARGS__ << ':'; dbg_out(__VA_ARGS__); } // a little bit too slow signed main(){ fastio; int n, m; cin >> n >> m; vector<int> pay (n), notes (m); for (auto &a: pay) cin >> a; for (auto &a: notes) cin >> a; vector<int> dp (1 << m, -1), r (1 << m); int a, b; bool ans=false; for (int i=0; i<n; i++){ for (int mask=1; mask<(1<<m); mask++){ for (int j=0; j<m; j++){ if (!(mask & (1 << j))) continue; if (dp[mask^(1<<j)] == i) { dp[mask] = dp[mask^(1<<j)]; r[mask] = r[mask^(1<<j)]+notes[j]; break; } else if (dp[mask^(1<<j)] == i-1){ if (r[mask^(1<<j)]+notes[j] == pay[i]){ dp[mask] = i; r[mask] = 0; break; } dp[mask] = dp[mask^(1<<j)]; r[mask] = r[mask^(1<<j)]+notes[j]}; } } if (dp[mask].first == n-1) ans = true; } } cout << (ans? "YES" : "NO") << '\n'; }

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

bank.cpp: In function 'int main()':
bank.cpp:47:54: error: expected ';' before '}' token
   47 |                     r[mask] = r[mask^(1<<j)]+notes[j]};
      |                                                      ^
      |                                                      ;
bank.cpp:50:20: error: 'mask' was not declared in this scope; did you mean 'std::filesystem::perms::mask'?
   50 |             if (dp[mask].first == n-1) ans = true;
      |                    ^~~~
      |                    std::filesystem::perms::mask
In file included from /usr/include/c++/10/filesystem:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:129,
                 from bank.cpp:1:
/usr/include/c++/10/bits/fs_fwd.h:152:7: note: 'std::filesystem::perms::mask' declared here
  152 |       mask  = 07777,
      |       ^~~~
bank.cpp:29:9: warning: unused variable 'a' [-Wunused-variable]
   29 |     int a, b;
      |         ^
bank.cpp:29:12: warning: unused variable 'b' [-Wunused-variable]
   29 |     int a, b;
      |            ^
bank.cpp: At global scope:
bank.cpp:54:5: error: 'cout' does not name a type
   54 |     cout << (ans? "YES" : "NO") << '\n';
      |     ^~~~
bank.cpp:55:1: error: expected declaration before '}' token
   55 | }
      | ^