Submission #63003

#TimeUsernameProblemLanguageResultExecution timeMemory
63003KHUSRAVDetecting Molecules (IOI16_molecules)C++14
0 / 100
6 ms860 KiB
#include "molecules.h"
#include<bits/stdc++.h>
using namespace std ;
vector<int> find_subset(int l, int u, vector<int> w) {

    vector< vector<int> > v;
    vector<int> y ;
    int used[u + 1];
    for(int i = 0 ; i <= u ; i++)
        used[i] = 0 ;
    y.push_back(0);
    v.push_back(y);
    for(int i = 0 ; i < w.size() ; i ++){
        int q = v.size();

        for(int j = 0 ; j < q ; j++){
            vector<int> g = v[j];
            if(g[0] + w[i] <= u){
                g[0] += w[i];
                g.push_back(i);
                if(used[g[0]] == 0){
                    used[g[0]] = 1 ;
                    v.push_back(g);
                }
                if(g[0] >= l){
                    vector<int> k ;
                    for(int j = 1 ; j < g.size() ; j ++)
                        k.push_back(g[j]);
                    return k;
                }
            }
        }
    }

}

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:13:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0 ; i < w.size() ; i ++){
                     ~~^~~~~~~~~~
molecules.cpp:27:39: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                     for(int j = 1 ; j < g.size() ; j ++)
                                     ~~^~~~~~~~~~
molecules.cpp:35:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...