# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1164542 | Dpika | Detecting Molecules (IOI16_molecules) | C++20 | 0 ms | 328 KiB |
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> find_subset(int l, int u, vector<int> w) {
int n=w.size();
vector<pair<int,int>>wa(n);
for (int i=0;i<n;i++){
wa[i].first=w[i];
wa[i].second=i;
}
sort(wa.begin(),wa.end());
int le=0,r=1,c=wa[0].first;
vector<int>p;
vector<int>re;
if (wa[0].first<=u and wa[0].first>=l){
p.push_back(wa[0].second);
return p;
}
else{
int xd=0;
p.push_back(wa[0].second);
while(le<n and r<n){
if (c<l){
p.push_back(wa[r].second);
c=wa[r].first+c;
r++;
}
else if (c>u){
c=c-wa[le].first;
xd++;
le++;
}
else{
sort(p.begin(),p.end());
for(int i=xd;i<p.size();i++){
re.push_back(p[i]);
}
break;
}
if(le==r){
le++;
r++;
}
}
return re;
}
}
컴파일 시 표준 에러 (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... |