Submission #312098

# Submission time Handle Problem Language Result Execution time Memory
312098 2020-10-12T11:14:23 Z Nayna Detecting Molecules (IOI16_molecules) C++14
0 / 100
0 ms 256 KB
#include "molecules.h"
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

vector<int> find_subset(int l, int u, vector<int> w)
{
    ll sum = 0;
    int idx = -1;
    for(int i = 0; i < w.size(); i++)
    {
        if(sum>=l)
        {
            idx = i-1;
            break;
        }
        sum+=w[i];
    }
    vector<int>res;
    if(sum>=l && sum<=u)
        for(int i = 0; i <= idx; i++) res.push_back(i+1);
    else res.push_back(0);

    return res;
}

Compilation message

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:10:22: 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 = 0; i < w.size(); i++)
      |                    ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB sum of weights should be in [10..12] but it is 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB sum of weights should be in [302..304] but it is 50
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB sum of weights should be in [10..12] but it is 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB sum of weights should be in [10..12] but it is 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB sum of weights should be in [10..12] but it is 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB sum of weights should be in [10..12] but it is 9
2 Halted 0 ms 0 KB -