Submission #843204

#TimeUsernameProblemLanguageResultExecution timeMemory
843204Mr_HusanboyDetecting Molecules (IOI16_molecules)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "molecules.h" using namespace std; template<typename T> int len(T &a){return a.size();} vector<int> find_subset(int l, int u, vector<int> w) { int n = len(w); vector<int> dp(u + 1); dp[0] = 1; vector<int> par(u + 1); for(int i = 0; i < n; i ++){ for(int j = u; j >= w[i]; j --){ if(!dp[j] && dp[j - w[i]]){ par[j] = i; dp[j] = 1; } } } int yes = -1; for(int i = l; i <= u; i ++) if(dp[i]) yes = i; if(yes == -1) return {}; vector<int> ans; while(yes != 0){ ans.push_back(par[yes]); yes -= w[par[yes]]; } reverse(all(ans)); return ans; }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:34:13: error: 'all' was not declared in this scope; did you mean 'std::filesystem::perms::all'?
   34 |     reverse(all(ans));
      |             ^~~
      |             std::filesystem::perms::all
In file included from /usr/include/c++/10/filesystem:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:129,
                 from molecules.cpp:1:
/usr/include/c++/10/bits/fs_fwd.h:148:7: note: 'std::filesystem::perms::all' declared here
  148 |       all  =  0777,
      |       ^~~