제출 #1024930

#제출 시각아이디문제언어결과실행 시간메모리
1024930alex_2008Detecting Molecules (IOI16_molecules)C++14
69 / 100
1073 ms5484 KiB
#include "molecules.h" #include <iostream> #include <cmath> #include <vector> #include <algorithm> #include <set> #include <map> typedef long long ll; using namespace std; const int N = 2e5 + 10; const int INF = 1e9 + 10; vector <int> find_subset(int l, int u, vector <int> w) { int n = (int)w.size(); vector <pair<int, int>> esim; for (int i = 0; i < n; i++) { esim.push_back({ w[i], i }); } sort(esim.begin(), esim.end()); for (int i = 0; i < n; i++) { int sm = 0; vector <int> v; for (int j = i; j < n; j++) { sm += esim[j].first; v.push_back(esim[j].second); if (sm >= l && sm <= u) { return v; } } } return {}; } /* int main() { for (auto it : find_subset(15, 17, { 6, 8, 8, 7 })) { cout << it << " "; } } */
#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...