제출 #1229026

#제출 시각아이디문제언어결과실행 시간메모리
1229026LmaoLmaoBank (IZhO14_bank)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#define name "a"
//#define int long long
#define fi first
#define se second
using namespace std;

using ii=pair<int,int>;

bitset<(1<<20)> dp[21];
int a[21];
int pre[21];
int b[20];
int sum[1<<20];
vector<int> adj[1<<20];

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int n,m;
    cin >> n >> m;
    for(int i=1;i<=n;i++) {
        cin >> a[i];
        pre[i]=pre[i-1]+a[i];
    }
    for(int i=0;i<m;i++) {
        cin >> b[i];
    }
    for(int i=0;i<(1<<m);i++) {
        for(int j=0;j<m;j++) {
            if((i >> j & 1)==1) {
                sum[i]+=b[j];
                adj[i].push_back(j);
            }
        }
        //cout << sum[i] << endl;
        dp[0][i]=1;
    }
    for(int i=1;i<=n;++i) {
        for(int j=1;j < (1 << m);++j) {
            //cout << j << ' ';
            for(int k:adj[j]) {
                if(dp[i-1][j^(1<<k)]) {
                    dp[i][j]|=(1&(sum[j]==pre[i]));
                }
                if(dp[i][j^(1<<k)]) {
                    dp[i][j]|=1;
                }
            }
            //cout<< ' ' << dp[i][j] << ' ' << sum[j] << endl;
        }
    }
    if(dp[n][(1<<m)-1]) cout << "YES"; else cout << "NO";
    return 0;
}

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

bank.cpp: In function 'int main()':
bank.cpp:45:29: error: no match for 'operator|=' (operand types are 'std::bitset<1048576>::reference' and 'int')
   45 |                     dp[i][j]|=(1&(sum[j]==pre[i]));
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:45,
                 from bank.cpp:1:
/usr/include/c++/11/cstddef:169:3: note: candidate: 'constexpr std::byte& std::operator|=(std::byte&, std::byte)'
  169 |   operator|=(byte& __l, byte __r) noexcept
      |   ^~~~~~~~
/usr/include/c++/11/cstddef:169:20: note:   no known conversion for argument 1 from 'std::bitset<1048576>::reference' to 'std::byte&'
  169 |   operator|=(byte& __l, byte __r) noexcept
      |              ~~~~~~^~~
In file included from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from bank.cpp:1:
/usr/include/c++/11/bits/ios_base.h:99:3: note: candidate: 'const std::_Ios_Fmtflags& std::operator|=(std::_Ios_Fmtflags&, std::_Ios_Fmtflags)'
   99 |   operator|=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
      |   ^~~~~~~~
/usr/include/c++/11/bits/ios_base.h:99:29: note:   no known conversion for argument 1 from 'std::bitset<1048576>::reference' to 'std::_Ios_Fmtflags&'
   99 |   operator|=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
      |              ~~~~~~~~~~~~~~~^~~
/usr/include/c++/11/bits/ios_base.h:141:3: note: candidate: 'const std::_Ios_Openmode& std::operator|=(std::_Ios_Openmode&, std::_Ios_Openmode)'
  141 |   operator|=(_Ios_Openmode& __a, _Ios_Openmode __b)
      |   ^~~~~~~~
/usr/include/c++/11/bits/ios_base.h:141:29: note:   no known conversion for argument 1 from 'std::bitset<1048576>::reference' to 'std::_Ios_Openmode&'
  141 |   operator|=(_Ios_Openmode& __a, _Ios_Openmode __b)
      |              ~~~~~~~~~~~~~~~^~~
/usr/include/c++/11/bits/ios_base.h:181:3: note: candidate: 'const std::_Ios_Iostate& std::operator|=(std::_Ios_Iostate&, std::_Ios_Iostate)'
  181 |   operator|=(_Ios_Iostate& __a, _Ios_Iostate __b)
      |   ^~~~~~~~
/usr/include/c++/11/bits/ios_base.h:181:28: note:   no known conversion for argument 1 from 'std::bitset<1048576>::reference' to 'std::_Ios_Iostate&'
  181 |   operator|=(_Ios_Iostate& __a, _Ios_Iostate __b)
      |              ~~~~~~~~~~~~~~^~~
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:105,
                 from bank.cpp:1:
/usr/include/c++/11/future:166:18: note: candidate: 'std::launch& std::operator|=(std::launch&, std::launch)'
  166 |   inline launch& operator|=(launch& __x, launch __y) noexcept
      |                  ^~~~~~~~
/usr/include/c++/11/future:166:37: note:   no known conversion for argument 1 from 'std::bitset<1048576>::reference' to 'std::launch&'
  166 |   inline launch& operator|=(launch& __x, launch __y) noexcept
      |                             ~~~~~~~~^~~
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:127,
                 from bank.cpp:1:
/usr/include/c++/11/charconv:678:3: note: candidate: 'constexpr std::chars_format& std::operator|=(std::chars_format&, std::chars_format)'
  678 |   operator|=(chars_format& __lhs, chars_format __rhs) noexcept
      |   ^~~~~~~~
/usr/include/c++/11/charconv:678:28: note:   no known conversion for argument 1 from 'std::bitset<1048576>::reference' to 'std::chars_format&'
  678 |   operator|=(chars_format& __lhs, chars_format __rhs) noexcept
      |              ~~~~~~~~~~~~~~^~~~~
bank.cpp:48:29: error: no match for 'operator|=' (operand types are 'std::bitset<1048576>::reference' and 'int')
   48 |                     dp[i][j]|=1;
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:45,
                 from bank.cpp:1:
/usr/include/c++/11/cstddef:169:3: note: candidate: 'constexpr std::byte& std::operator|=(std::byte&, std::byte)'
  169 |   operator|=(byte& __l, byte __r) noexcept
      |   ^~~~~~~~
/usr/include/c++/11/cstddef:169:20: note:   no known conversion for argument 1 from 'std::bitset<1048576>::reference' to 'std::byte&'
  169 |   operator|=(byte& __l, byte __r) noexcept
      |              ~~~~~~^~~
In file included from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from bank.cpp:1:
/usr/include/c++/11/bits/ios_base.h:99:3: note: candidate: 'const std::_Ios_Fmtflags& std::operator|=(std::_Ios_Fmtflags&, std::_Ios_Fmtflags)'
   99 |   operator|=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
      |   ^~~~~~~~
/usr/include/c++/11/bits/ios_base.h:99:29: note:   no known conversion for argument 1 from 'std::bitset<1048576>::reference' to 'std::_Ios_Fmtflags&'
   99 |   operator|=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
      |              ~~~~~~~~~~~~~~~^~~
/usr/include/c++/11/bits/ios_base.h:141:3: note: candidate: 'const std::_Ios_Openmode& std::operator|=(std::_Ios_Openmode&, std::_Ios_Openmode)'
  141 |   operator|=(_Ios_Openmode& __a, _Ios_Openmode __b)
      |   ^~~~~~~~
/usr/include/c++/11/bits/ios_base.h:141:29: note:   no known conversion for argument 1 from 'std::bitset<1048576>::reference' to 'std::_Ios_Openmode&'
  141 |   operator|=(_Ios_Openmode& __a, _Ios_Openmode __b)
      |              ~~~~~~~~~~~~~~~^~~
/usr/include/c++/11/bits/ios_base.h:181:3: note: candidate: 'const std::_Ios_Iostate& std::operator|=(std::_Ios_Iostate&, std::_Ios_Iostate)'
  181 |   operator|=(_Ios_Iostate& __a, _Ios_Iostate __b)
      |   ^~~~~~~~
/usr/include/c++/11/bits/ios_base.h:181:28: note:   no known conversion for argument 1 from 'std::bitset<1048576>::reference' to 'std::_Ios_Iostate&'
  181 |   operator|=(_Ios_Iostate& __a, _Ios_Iostate __b)
      |              ~~~~~~~~~~~~~~^~~
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:105,
                 from bank.cpp:1:
/usr/include/c++/11/future:166:18: note: candidate: 'std::launch& std::operator|=(std::launch&, std::launch)'
  166 |   inline launch& operator|=(launch& __x, launch __y) noexcept
      |                  ^~~~~~~~
/usr/include/c++/11/future:166:37: note:   no known conversion for argument 1 from 'std::bitset<1048576>::reference' to 'std::launch&'
  166 |   inline launch& operator|=(launch& __x, launch __y) noexcept
      |                             ~~~~~~~~^~~
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:127,
                 from bank.cpp:1:
/usr/include/c++/11/charconv:678:3: note: candidate: 'constexpr std::chars_format& std::operator|=(std::chars_format&, std::chars_format)'
  678 |   operator|=(chars_format& __lhs, chars_format __rhs) noexcept
      |   ^~~~~~~~
/usr/include/c++/11/charconv:678:28: note:   no known conversion for argument 1 from 'std::bitset<1048576>::reference' to 'std::chars_format&'
  678 |   operator|=(chars_format& __lhs, chars_format __rhs) noexcept
      |              ~~~~~~~~~~~~~~^~~~~