이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
struct Molec {
long long int poids;
int pos;
bool operator< (Molec other) {
return poids < other.poids;
}
};
vector<int> find_subset(int l, int u, vector<int> w) {
int n = w.size();
vector<Molec> molecules(n);
for(int loop = 0; loop < n; ++loop) {
molecules[loop] = {w[loop], loop};
}
sort(molecules.begin(), molecules.end());
long long int somme = 0;
int fin = 0;
while(somme <= u) {
if(somme + molecules[fin].poids <= u) {
somme += molecules[fin].poids;
fin++;
}
else {
break;
}
}
vector<int> indice;
if(l <= somme && somme <= u) {
for(int loop = 0; loop < fin; ++loop) {
indice.push_back(molecules[loop].pos);
}
return indice;
}
for(int loop = fin; loop < u; ++loop) {
somme -= molecules[loop-fin].poids;
somme += molecules[loop].poids;
if(l <= somme && somme <= u) {
for(int looping = loop-fin+1; looping <= loop; ++looping) {
indice.push_back(molecules[looping].pos);
}
return indice;
}
}
return indice;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |