Submission #390413

#TimeUsernameProblemLanguageResultExecution timeMemory
390413marat0210Detecting Molecules (IOI16_molecules)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "molecules.h"

using namespace std;

vector<int> find_subset(int l, int u, vector<int> w) {
    vector <int> res;
    int mi = l / w[0];
    if (mi * w[0] < l and w.size() >= mi) {
        if (mi * w[0] + w[0] >= l and mi * w[0] + w[0] <= u and w.size() >= mi + 1) {
            for (int i = 0; i < mi + 1; ++i) {
                res.push_back(i);
            }
            return res;
        }
    }
    else if (mi * w[0] >= l and mi * w[0] <= r and w.size() >= mi) {
        for (int i = 0; i < mi; ++i) {
            res.push_back(i);
        }
        return res;
    }
    return vector<int>();
}

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:9:36: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
    9 |     if (mi * w[0] < l and w.size() >= mi) {
      |                           ~~~~~~~~~^~~~~
molecules.cpp:10:74: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   10 |         if (mi * w[0] + w[0] >= l and mi * w[0] + w[0] <= u and w.size() >= mi + 1) {
      |                                                                 ~~~~~~~~~^~~~~~~~~
molecules.cpp:17:46: error: 'r' was not declared in this scope
   17 |     else if (mi * w[0] >= l and mi * w[0] <= r and w.size() >= mi) {
      |                                              ^
molecules.cpp:17:61: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   17 |     else if (mi * w[0] >= l and mi * w[0] <= r and w.size() >= mi) {
      |                                                    ~~~~~~~~~^~~~~