Submission #530659

#TimeUsernameProblemLanguageResultExecution timeMemory
530659OttoTheDinoGenetics (BOI18_genetics)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

#define rep(i,s,e)                  for (int i = s; i <= e; ++i)
#define rrep(i,s,e)                 for (int i = s; i >= e; --i)
#define pb                          push_back
#define pf                          push_front
#define fi                          first
#define se                          second
#define all(a)                      a.begin(), a.end()
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    srand(7);

    int n, m, k; cin >> n >> m >> k;
    bitset<1800> x[n][4];

    unordered_map<char, int> mp;
    mp['A'] = 0;
    mp['C'] = 1;
    mp['G'] = 2;
    mp['T'] = 3;

    rep (i,0,n-1) {
        string s; cin >> s;
        rep (j,0,(int)s.size()-1) x[i][mp[s[j]]] |= bitset<4100>(1)<<j;
    }

    vi order(n);
    iota(all(order), 0);
    random_shuffle(all(order));

    int s[n] = {};
    rep (iii,0,n-1) {
        int i = order[iii];
        if (s[i]) continue;
        bool suc = 1;
        rep (ij,0,n-1) {
            int j = order[ij];
            if (i==j) continue;
            int cnt = 0;
            rep (l,0,3) cnt += (x[i][l]^x[j][l]).count();
            if (cnt/2!=k) {
                s[j] = 1;
                suc = 0;
                break;
            }
        }
        if (suc) {
            cout << i+1 << "\n";
            break;
        }
    }

    return 0;
}

Compilation message (stderr)

genetics.cpp: In function 'int main()':
genetics.cpp:36:50: error: no match for 'operator|=' (operand types are 'std::bitset<1800>' and 'std::bitset<4100>')
   36 |         rep (j,0,(int)s.size()-1) x[i][mp[s[j]]] |= bitset<4100>(1)<<j;
      |                                   ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:66,
                 from genetics.cpp:1:
/usr/include/c++/10/bitset:979:7: note: candidate: 'std::bitset<_Nb>& std::bitset<_Nb>::operator|=(const std::bitset<_Nb>&) [with long unsigned int _Nb = 1800]'
  979 |       operator|=(const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
/usr/include/c++/10/bitset:979:37: note:   no known conversion for argument 1 from 'std::bitset<4100>' to 'const std::bitset<1800>&'
  979 |       operator|=(const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT
      |                  ~~~~~~~~~~~~~~~~~~~^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:45,
                 from genetics.cpp:1:
/usr/include/c++/10/cstddef:160:3: note: candidate: 'constexpr std::byte& std::operator|=(std::byte&, std::byte)'
  160 |   operator|=(byte& __l, byte __r) noexcept
      |   ^~~~~~~~
/usr/include/c++/10/cstddef:160:20: note:   no known conversion for argument 1 from 'std::bitset<1800>' to 'std::byte&'
  160 |   operator|=(byte& __l, byte __r) noexcept
      |              ~~~~~~^~~
In file included from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from genetics.cpp:1:
/usr/include/c++/10/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++/10/bits/ios_base.h:99:29: note:   no known conversion for argument 1 from 'std::bitset<1800>' to 'std::_Ios_Fmtflags&'
   99 |   operator|=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
      |              ~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/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++/10/bits/ios_base.h:141:29: note:   no known conversion for argument 1 from 'std::bitset<1800>' to 'std::_Ios_Openmode&'
  141 |   operator|=(_Ios_Openmode& __a, _Ios_Openmode __b)
      |              ~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/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++/10/bits/ios_base.h:181:28: note:   no known conversion for argument 1 from 'std::bitset<1800>' to 'std::_Ios_Iostate&'
  181 |   operator|=(_Ios_Iostate& __a, _Ios_Iostate __b)
      |              ~~~~~~~~~~~~~~^~~
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:105,
                 from genetics.cpp:1:
/usr/include/c++/10/future:167:18: note: candidate: 'std::launch& std::operator|=(std::launch&, std::launch)'
  167 |   inline launch& operator|=(launch& __x, launch __y)
      |                  ^~~~~~~~
/usr/include/c++/10/future:167:37: note:   no known conversion for argument 1 from 'std::bitset<1800>' to 'std::launch&'
  167 |   inline launch& operator|=(launch& __x, launch __y)
      |                             ~~~~~~~~^~~
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:127,
                 from genetics.cpp:1:
/usr/include/c++/10/charconv:680:3: note: candidate: 'constexpr std::chars_format& std::operator|=(std::chars_format&, std::chars_format)'
  680 |   operator|=(chars_format& __lhs, chars_format __rhs) noexcept
      |   ^~~~~~~~
/usr/include/c++/10/charconv:680:28: note:   no known conversion for argument 1 from 'std::bitset<1800>' to 'std::chars_format&'
  680 |   operator|=(chars_format& __lhs, chars_format __rhs) noexcept
      |              ~~~~~~~~~~~~~~^~~~~