| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 1219434 | AMel0n | Detecting Molecules (IOI16_molecules) | C++20 | 0 ms | 328 KiB | 
// subtask 3, 4 and possibly 5
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i,N) for(ll i = 0; i < N; i++)
#define all(x) (x).begin(), (x).end()
#define F first 
#define S second
#include "molecules.h"
vector<int> find_subset(int l, int u, vector<int> W) {
    bitset<32> dp;
    dp[0] = 1;
    vector<int> res;
    int backtrack = -1;
    bool yes = 0;
    FOR(i, W.size()) {
        if (yes) break;
        for(ll w = u; w >= 0; w--) {
            if (w != 0 && w-W[i] >= 0) dp[w] = (dp[w-W[i]] == 1);
            if (l <= w && w <= u && dp[w])  {
                res.push_back(i);
                backtrack = w-W[i];
                yes = 1;
                break;
            }
        }
    }
    if (backtrack == -1) return res;
    while(backtrack != 0) {
        FOR(i,W.size()) {
            if (dp[backtrack-W[i]] == 1 && find(all(res), i) == res.end()) {
                res.push_back(i);
                backtrack = backtrack-W[i];
                break;
            }
        }
    }
    return res;
}
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... | ||||
