Submission #233560

# Submission time Handle Problem Language Result Execution time Memory
233560 2020-05-21T01:32:56 Z pere_gil Detecting Molecules (IOI16_molecules) C++14
0 / 100
5 ms 256 KB
#include <iostream>
#include "molecules.h"

using namespace std;

std::vector<int> find_subset(int l, int u, std::vector<int> w){
    int tot=1<<w.size();
    std::vector<int> pos;
    for(int i=0;i<tot;i++){
        int sum=0;
        pos.clear();
        for(int j=0;j<w.size();j++){
            if((i&(1<<j)) % w[j]<=u){ sum+=w[j]; pos.push_back(w[j]); }
            if(sum<=u and sum>=l){
                break;
            }
        }
    }
    return pos;
}

Compilation message

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:12:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int j=0;j<w.size();j++){
                     ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB Integer 9 violates the range [0, 0]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB Integer 50 violates the range [0, 11]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB Integer 9 violates the range [0, 0]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB Integer 9 violates the range [0, 0]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB Integer 9 violates the range [0, 0]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB Integer 9 violates the range [0, 0]
2 Halted 0 ms 0 KB -