제출 #404071

#제출 시각아이디문제언어결과실행 시간메모리
404071luisgalanDetecting Molecules (IOI16_molecules)C++14
0 / 100
1 ms288 KiB
#include<bits/stdc++.h> #include "molecules.h" using namespace std; typedef long long int ll; #define debug(x) cerr << #x << " = " << (x) << endl vector<int> find_subset(int l, int u, vector<int> w) { int n = w.size(); vector<pair<int, int>> arr(n); for (int i = 0; i < n; i++) { arr[i] = { w[i], i }; } sort(arr.begin(), arr.end()); vector<int> presum(n); vector<int> ans; for (int k = 1; k < n; k++) { for (int i = 0; i + k <= n; i++) { ll sum = 0; for (int j = i; j < i + k; j++) { sum += arr[j].first; } if (sum >= l && sum <= u) { debug(sum); for (int j = i; j < i + k; j++) { ans.push_back(arr[j].second); } break; } } if (!ans.empty()) break; } return ans; // return vector<int>(0); }
#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...