제출 #352368

#제출 시각아이디문제언어결과실행 시간메모리
352368spike1236Detecting Molecules (IOI16_molecules)C++14
100 / 100
63 ms6384 KiB
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define ll long long
#define ld long double
#define all(_v) _v.begin(), _v.end()
#define sz(_v) (int)_v.size()
#define pii pair <int, int>
#define pll pair <ll, ll>
#define veci vector <int>
#define vecll vector <ll>
veci find_subset(int asd, int asdas, veci w) {
    ll L = asd, R = asdas;
    int n = sz(w);
    vector <pair <ll, int> > a;
    for(int i = 0; i < n; ++i)
        a.pb(mp(w[i], i));
    sort(all(a));
    ll sum = 0;
    int r = 0;
    for(int l = 0; l < n; ++l) {
        while(r < n && sum + a[r].f <= R) sum += a[r++].f;
        if(L <= sum && sum <= R) {
            veci res;
            for(int j = l; j < r; ++j) res.pb(a[j].s);
            return res;
        }
        sum -= a[l].f;
    }
    return {};
}
#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...