# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
445567 | hgmhc | Detecting Molecules (IOI16_molecules) | C++17 | 200 ms | 716 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "molecules.h"
#include <bits/stdc++.h>
#define REP(i,a,b) for (auto i = (a); i <= (b); ++i)
#define PER(i,a,b) for (auto i = (b); i >= (a); --i)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
using ii = pair<int,int>;
const int N = 20'0000;
bool dp[1003];
vector<int> v[1003];
vector<ii> mol;
std::vector<int> find_subset(int l, int u, std::vector<int> W) {
REP(i,0,size(W)-1) mol.push_back({W[i],i});
dp[0] = true;
for (auto [w,i] : mol) {
PER(x,0,1000) {
if (x+w > 1000 || !dp[x]) continue;
dp[x+w] = true;
v[x+w].assign(ALL(v[x]));
v[x+w].push_back(i);
if (l <= x+w && x+w <= u) {
sort(ALL(v[x+w]));
return v[x+w];
}
}
}
return std::vector<int>(0);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |