Submission #394140

# Submission time Handle Problem Language Result Execution time Memory
394140 2021-04-25T20:47:27 Z Tsvetelina Detecting Molecules (IOI16_molecules) C++14
0 / 100
1 ms 204 KB
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;

std::vector<int> find_subset(int l, int u, std::vector<int> w) {
     int  t=w.size();
    vector <int> otg;
    sort (w.begin(), w.end());
    if (w[0]>u) {
        return otg;
    }
    if (w[0]>=l && w[0]<=u) {
        otg.push_back(w[0]);
        return otg;
    }
    otg.push_back(w[0]);
    int sum=w[0];
    for (int i=1; i<t; i++) {
        sum=sum+w[i];
        otg.push_back(w[i]);
        if (sum>=l) {
            return otg;
        }
    }

}

Compilation message

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:26:1: warning: control reaches end of non-void function [-Wreturn-type]
   26 | }
      | ^
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Integer 7 violates the range [0, 1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Integer 50 violates the range [0, 11]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Integer 7 violates the range [0, 1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Integer 7 violates the range [0, 1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Integer 7 violates the range [0, 1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Integer 7 violates the range [0, 1]
2 Halted 0 ms 0 KB -