Submission #114843

#TimeUsernameProblemLanguageResultExecution timeMemory
114843oolimryDetecting Molecules (IOI16_molecules)C++14
9 / 100
2 ms384 KiB
#include "molecules.h"
#include <bits/stdc++.h>

using namespace std;

vector<int> find_subset(int l, int u, vector<int> w) {
    vector<int> v;

    int n = w.size();
    typedef pair<long long, long long> ii;

    ii arr[n];

    for(int i = 0;i < n;i++){
        arr[i] = ii(w[i],i);
    }

    sort(arr,arr+n);

    long long low = 0;
    long long high = 0;
    vector<int> ll;
    vector<int> hh;
    for(int c = 0;c < n;c++){
        low += arr[c].first;
        high += arr[n-c-1].first;
        ll.push_back(arr[c].second);
        hh.push_back(arr[n-c-1].second);
        if(l <= low && low <= u){
            return ll;
        }
        else if(l <= high && high <= u){
            return hh;
        }
        else if(low < l && high > u){
            
        }
    }


    return v;
}
#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...