Submission #777481

#TimeUsernameProblemLanguageResultExecution timeMemory
777481JoenPoenManDetecting Molecules (IOI16_molecules)C++17
0 / 100
2 ms596 KiB
#include "molecules.h"
#include <bits/stdc++.h>

using namespace std;

typedef pair<int, vector<int>> iv;

vector<iv> dp;

std::vector<int> find_subset(int l, int u, std::vector<int> w) {
    dp.push_back({0, {}});
    for (int i = 0; i < w.size(); i++) {
        for (iv eel : dp) {
            int we; vector<int> contents;
            tie(we, contents) = eel;
            if (we+w[i] <= u) {
                contents.push_back(i);
                if (we+w[i] >= l) return contents; 
                dp.push_back({we+w[i], contents});
            }
        }
    }

    return std::vector<int>(0);
}

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:12:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |     for (int i = 0; i < w.size(); i++) {
      |                     ~~^~~~~~~~~~
#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...