제출 #425337

#제출 시각아이디문제언어결과실행 시간메모리
425337dreezyDetecting Molecules (IOI16_molecules)C++17
9 / 100
1 ms204 KiB
#include <bits/stdc++.h> #include "molecules.h" using namespace std; #define pb push_back #define pi pair<int,int> #define w first #define ind second #define ll long long #define mp make_pair vector<int> find_subset(int l, int u, vector<int> w) { int n = w.size(); vector<pi> weights(n); for(int i =0; i<n ;i++){ weights[i] = {w[i], i}; } sort(weights.begin(), weights.end()); vector<int> ans; ll cursum = 0; auto it = lower_bound(weights.begin(), weights.end(), mp(u , - 1) ); if(it == weights.end()) it = prev(it); while(true){ cursum += it->w; ans.pb(it->ind); if( l<= cursum and cursum <=u){ sort(ans.begin(), ans.end()); //for(int a : ans)cout << a <<","; //cout <<endl; return ans; } if(it == weights.begin()){ break; } it = prev(it); } return vector<int>(); } /***************/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...