Submission #589826

#TimeUsernameProblemLanguageResultExecution timeMemory
589826Sam_a17Detecting Molecules (IOI16_molecules)C++14
0 / 100
1 ms340 KiB
#define _CRT_SECURE_NO_WARNINGS #include <bits/stdc++.h> // #include "molecules.h" #include <cstdio> using namespace std; #define ll long long const int N = 1e4 + 10; int n; bool dp[N]; bitset<N> bit[N]; std::vector<int> find_subset(int l, int u, std::vector<int> w) { n = w.size(); vector<int> possible{0}; vector<int> answ; dp[0] = true; for(int i = 0; i < n; i++) { vector<int> to_add; for(auto j: possible) { if(j + w[i] > u || dp[j + w[i]]) { continue; } dp[j + w[i]] = true; to_add.push_back(j); } for(auto j: to_add) { bit[j + w[i]] = bit[j]; bit[j + w[i]][i] = 1; if(j + w[i] >= l && j + w[i] <= u) { for(int k = 0; k < n; k++) { if(bit[j + w[i]][k]) { answ.push_back(k + 1); } } break; } possible.push_back(j + w[i]); } if(!answ.empty()) { break; } sort(possible.begin(), possible.end()); } return answ; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...