Submission #1219312

#TimeUsernameProblemLanguageResultExecution timeMemory
1219312LIADetecting Molecules (IOI16_molecules)C++17
0 / 100
934 ms131072 KiB
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
typedef int ll;
typedef tuple <ll,ll,ll> plll;
typedef vector <plll> vplll;
typedef pair <ll,ll> pll;
typedef vector <ll> vll;
typedef vector <pll> vpll;
typedef vector <vector <pll>> vvpll;
typedef vector <vector <ll>> vvll;
typedef vector <bool> vb;
typedef vector <vector <bool>> vvb;
#define loop(i, s, e) for (ll i = (s); i < (e); ++i)
#define loopr(i, e, s) for (ll i = (e)-1; i >= (s); --i)
#define all(a) a.begin(), a.end()
const ll inf = 1e9 + 7;

std::vector<int> find_subset(int l, int r, std::vector<int> w) {
    ll n = w.size();
    vector<pair<ll,vll>> v;
    loop(i,0,n) {
        ll num = w[i];
        vector<pair<ll,vll>> p = v;
        for (auto [sum, vec] : p) {
            if (sum> r) break;
            vll c = vec;
            c.push_back(i);
            ll s = sum+num;
            v.push_back({s, {c}});
            if (s >=l && s<=r) return {c};
        }
        v.push_back({num,{i}});
        if (num>=l && num<=r) return {i};
    }
    return {};
}

Compilation message (stderr)

molecules.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
molecules_c.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
#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...