Submission #299468

# Submission time Handle Problem Language Result Execution time Memory
299468 2020-09-15T01:32:37 Z nicholask Detecting Molecules (IOI16_molecules) C++14
0 / 100
1 ms 256 KB
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
vector <int> find_subset(int l,int u,vector<int> w){
    int n=w.size();
    pair <int,int> a[n];
    for (int i=0; i<n; i++){
        cin>>a[i].first;
        a[i].second=i;
    }
    sort(a,a+n);
    long long sum=0,st=0;
    for (int i=0; i<n; i++){
        sum+=a[i].first;
        while (sum>u) sum-=a[st++].first;
        if (sum>=l){
            vector <int> ans;
            for (int j=st; j<=i; j++) ans.push_back(a[j].second);
            return ans;
        }
    }
}

Compilation message

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