# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1200327 | apelpisia | Detecting Molecules (IOI16_molecules) | C++20 | 36 ms | 4276 KiB |
#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(), lans, rans;
long long s=0;
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) 메시지
# | 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... |