#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
vector<int> ans;
vector<pair<int, int>> temp;
deque<int> dq;
bool check = false;
int ll=0, rr=0, sz = w.size(), s=0, lans, rans;
for(int i=0; i<sz; i++){
temp.push_back({w[i], i});
}
sort(temp.begin(), temp.end());
while(rr<sz){
s+=temp[rr].first;
dq.push_back(temp[rr].second);
while(s>u){
s-=temp[ll++].first;
dq.pop_front();
}
if(s>=l && s<=u){
lans = ll;
rans = rr;
check = true;
break;
}
rr++;
}
// if(check) cout << "check";
// else cout << "false";
if(check){
while(!dq.empty()){
ans.push_back(dq.front());
dq.pop_front();
}
return ans;
}
else return ans;
return std::vector<int>(0);
}
컴파일 시 표준 에러 (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 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... |