제출 #915263

#제출 시각아이디문제언어결과실행 시간메모리
915263SmuggingSpunDetecting Molecules (IOI16_molecules)C++14
69 / 100
27 ms4192 KiB
#include "molecules.h" #include<bits/stdc++.h> using namespace std; vector<int>find_subset(int l, int u, vector<int>w){ vector<int>p(w.size()); iota(p.begin(), p.end(), 0); sort(p.begin(), p.end(), [&] (int i, int j) -> bool{ return w[i] < w[j]; }); int index = int(w.size()) - 1, sum = 0; while(index > -1 && sum < l){ sum += w[p[index--]]; } int length = int(w.size()) - index - 1; while(index > -1 && sum > u){ sum -= w[p[index + length]] - w[p[index]]; index--; } if(sum > u || sum < l){ return vector<int>{}; } vector<int>ans(length); for(int i = 1; i <= length; i++){ ans[i - 1] = p[index + i]; } return ans; }
#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...