Submission #1062623

# Submission time Handle Problem Language Result Execution time Memory
1062623 2024-08-17T09:13:09 Z nvujica Detecting Molecules (IOI16_molecules) C++14
0 / 100
1 ms 348 KB
#include <bits/stdc++.h>
#include "molecules.h"

using namespace std;

const int maxn = 1e4 + 10;

int n;
int bio[maxn];

vector<int> find_subset(int l, int u, vector<int> w) {
    n = w.size();

    bio[0] = 0;

    for(int i = 0; i < n; i++){
        for(int j = maxn - 1; j >= 0; j--){
            if(bio[j] != -1 && j + w[i] <= u && bio[j + w[i]] == -1){
                bio[j + w[i]] = i;
            }
        }
    }

    int x = 0;

    for(int i = l; i <= u; i++){
        if(bio[i] != -1){
            x = i;
            break;
        }
    }

    vector <int> v;

    while(x){
        v.push_back(bio[x]);
        x -= w[bio[x]];
    }
    
    reverse(v.begin(), v.end());

    return v;
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -