Submission #1052624

# Submission time Handle Problem Language Result Execution time Memory
1052624 2024-08-10T17:49:10 Z thatsgonzalez Detecting Molecules (IOI16_molecules) C++14
0 / 100
1 ms 348 KB
#include "molecules.h"
#include <bits/stdc++.h>

using namespace std;

int const nmax = 1e4+10;

std::vector<int> find_subset(int l, int u, std::vector<int> w) {

    int n = w.size();
    vector <vector<int>> sol(u);
    bitset<nmax> vis;
    vis[0] = 1;
    for(int i = 0; i<n; i++){
        for(int j = 0; j<=u-w[i]; j++){
            if(!sol[j+w[i]].empty()) continue;
            if(vis[j]){
                vis[j+w[i]] = 1;
                vector<int> aux = sol[j];
                aux.push_back(i);
                sol[j+w[i]] = aux;
            }
        }
    }

    for(int i = l; i<=u; i++){
        if(vis[i]){
            return sol[i];
        }
    }

    return std::vector<int>(0);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB OK (n = 1, answer = NO)
2 Correct 0 ms 348 KB OK (n = 1, answer = NO)
3 Incorrect 0 ms 348 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB item #0 is taken twice
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB OK (n = 1, answer = NO)
2 Correct 0 ms 348 KB OK (n = 1, answer = NO)
3 Incorrect 0 ms 348 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB OK (n = 1, answer = NO)
2 Correct 0 ms 348 KB OK (n = 1, answer = NO)
3 Incorrect 0 ms 348 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB OK (n = 1, answer = NO)
2 Correct 0 ms 348 KB OK (n = 1, answer = NO)
3 Incorrect 0 ms 348 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB OK (n = 1, answer = NO)
2 Correct 0 ms 348 KB OK (n = 1, answer = NO)
3 Incorrect 0 ms 348 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -