Submission #283489

# Submission time Handle Problem Language Result Execution time Memory
283489 2020-08-25T20:30:22 Z pere_gil Detecting Molecules (IOI16_molecules) C++14
0 / 100
1 ms 384 KB
#include "bits/stdc++.h"
#include "molecules.h"
using namespace std;

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

    vector<int> res;
    int ac[w.size()]; ac[0]=w[0];

    for(int i=1;i<w.size();i++) ac[i]=w[i]+ac[i-1];

    int left=0,right=0;
    for(int i=0;i<w.size();i++){
        for(int j=i;j<w.size();j++){
            int exp=ac[j]-ac[i]+w[i];
            if(exp>=l and exp<=u){ left=i; right=j; }
        }
    }

    for(int i=left;i<=right;i++) res.push_back(w[i]);

    return res;
}

Compilation message

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:10:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |     for(int i=1;i<w.size();i++) ac[i]=w[i]+ac[i-1];
      |                 ~^~~~~~~~~
molecules.cpp:13:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |     for(int i=0;i<w.size();i++){
      |                 ~^~~~~~~~~
molecules.cpp:14:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |         for(int j=i;j<w.size();j++){
      |                     ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Integer 9 violates the range [0, 0]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Integer 50 violates the range [0, 11]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Integer 9 violates the range [0, 0]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Integer 9 violates the range [0, 0]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Integer 9 violates the range [0, 0]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Integer 9 violates the range [0, 0]
2 Halted 0 ms 0 KB -