Submission #265604

#TimeUsernameProblemLanguageResultExecution timeMemory
265604amallaDetecting Molecules (IOI16_molecules)C++17
Compilation error
0 ms0 KiB
#include "molecules.h" #include<bits/stdc++.h> using namespace std; #define ll long long int N, L, U; vector<int> W; bitset<10000> INF; bitset<10000> memo[10000]; bool vis[10000] = {0}; bitset<10000> DP(int i, int sum, bitset<10000> choosen) { if (sum>U) return INF; if (sum>=L) return choosen; if (i == N) return INF; if (vis[sum]) return memo[sum]; bitset<100> res1, res2, res; choosen[i] = 1; res1 = DP(i+1, sum + W[i], choosen); choosen[i] = 0; res2 = DP(i+1, sum, choosen); if (res1.count()>res2.count()) res = res1; else res = res2; memo[sum] = res; vis[sum] = true; return memo[sum]; } vector<int> find_subset(int l, int u, vector<int> w) { N = w.size(); L = l; U = u; W = w; bitset<10000> res = DP(0,0, INF); vector<int> Ans(res.count()); for (int i = 0, j = 0; i<N; ++i) { if (res[i]) { Ans[j] = i; ++j; } } return Ans; }

Compilation message (stderr)

molecules.cpp: In function 'std::bitset<10000> DP(int, int, std::bitset<10000>)':
molecules.cpp:21:39: error: no match for 'operator=' (operand types are 'std::bitset<100>' and 'std::bitset<10000>')
   21 |     res1 = DP(i+1, sum + W[i], choosen);
      |                                       ^
In file included from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:66,
                 from molecules.cpp:2:
/usr/include/c++/9/bitset:751:11: note: candidate: 'constexpr std::bitset<100>& std::bitset<100>::operator=(const std::bitset<100>&)'
  751 |     class bitset
      |           ^~~~~~
/usr/include/c++/9/bitset:751:11: note:   no known conversion for argument 1 from 'std::bitset<10000>' to 'const std::bitset<100>&'
/usr/include/c++/9/bitset:751:11: note: candidate: 'constexpr std::bitset<100>& std::bitset<100>::operator=(std::bitset<100>&&)'
/usr/include/c++/9/bitset:751:11: note:   no known conversion for argument 1 from 'std::bitset<10000>' to 'std::bitset<100>&&'
molecules.cpp:23:32: error: no match for 'operator=' (operand types are 'std::bitset<100>' and 'std::bitset<10000>')
   23 |     res2 = DP(i+1, sum, choosen);
      |                                ^
In file included from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:66,
                 from molecules.cpp:2:
/usr/include/c++/9/bitset:751:11: note: candidate: 'constexpr std::bitset<100>& std::bitset<100>::operator=(const std::bitset<100>&)'
  751 |     class bitset
      |           ^~~~~~
/usr/include/c++/9/bitset:751:11: note:   no known conversion for argument 1 from 'std::bitset<10000>' to 'const std::bitset<100>&'
/usr/include/c++/9/bitset:751:11: note: candidate: 'constexpr std::bitset<100>& std::bitset<100>::operator=(std::bitset<100>&&)'
/usr/include/c++/9/bitset:751:11: note:   no known conversion for argument 1 from 'std::bitset<10000>' to 'std::bitset<100>&&'
molecules.cpp:28:17: error: no match for 'operator=' (operand types are 'std::bitset<10000>' and 'std::bitset<100>')
   28 |     memo[sum] = res;
      |                 ^~~
In file included from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:66,
                 from molecules.cpp:2:
/usr/include/c++/9/bitset:751:11: note: candidate: 'constexpr std::bitset<10000>& std::bitset<10000>::operator=(const std::bitset<10000>&)'
  751 |     class bitset
      |           ^~~~~~
/usr/include/c++/9/bitset:751:11: note:   no known conversion for argument 1 from 'std::bitset<100>' to 'const std::bitset<10000>&'
/usr/include/c++/9/bitset:751:11: note: candidate: 'constexpr std::bitset<10000>& std::bitset<10000>::operator=(std::bitset<10000>&&)'
/usr/include/c++/9/bitset:751:11: note:   no known conversion for argument 1 from 'std::bitset<100>' to 'std::bitset<10000>&&'