제출 #651354

#제출 시각아이디문제언어결과실행 시간메모리
651354pauloamedDetecting Molecules (IOI16_molecules)C++17
0 / 100
1 ms212 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>> W; for(int i = 0; i < n; ++i){ W.push_back({w[i], i}); } sort(W.begin(), W.end()); vector<int> ans; for(int i = 0; i < n; ++i){ int mini = W[i].first; int id_mini = W[i].second; int maxi = W.back().first; int id_maxi = W.back().second; if(mini > u) return {}; else if(mini >= l){ ans.push_back(id_mini); return ans; }else{ // mini ta a esquerda // maxi ta dentro ou a esquerda assert(maxi <= u); ans.push_back(id_maxi); if(maxi >= l){ // maxi ta dentro return ans; }else{ // maxi ta a esquerda l -= maxi; u -= maxi; } W.pop_back(); } } if(0 >= l && 0 <= u) return ans; else return {}; }
#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...