Submission #394138

# Submission time Handle Problem Language Result Execution time Memory
394138 2021-04-25T20:24:57 Z Tsvetelina Detecting Molecules (IOI16_molecules) C++14
0 / 100
1 ms 204 KB
#pragma once
#include <bits/stdc++.h>
#include <vector>
using namespace std;
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
    const int MAX_N=10010;
    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:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:6:15: warning: unused variable 'MAX_N' [-Wunused-variable]
    6 |     const int MAX_N=10010;
      |               ^~~~~
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 -