| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1354603 | lizi14 | Detecting Molecules (IOI16_molecules) | C++20 | 27 ms | 3752 KiB |
#include <bits/stdc++.h>
#include "molecules.h"
using namespace std;
vector<int> find_subset(int l, int u, vector<int> w) {
int n=w.size();
vector<pair<int,int>>x(n);
for(int i=0; i<n; i++){
x[i].first=w[i];
x[i].second=i;
}
sort(x.begin(),x.end());
vector<int>ans;
long long sum=0;
int j=0;
for(int i=0; i<n; i++){
sum+=x[i].first;
if(sum<=u && sum>=l){
for(int h=j; h<=i; h++){
ans.push_back(x[h].second);
}
return ans;
}
if(sum>u){
while(j<n && sum>u){
sum-=x[j].first;
j++;
}
if(sum>=l && sum<=u){
for(int h=j; h<=i; h++){
ans.push_back(x[h].second);
}
return ans;
}
}
}
return ans;
}
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
