Submission #404068

#TimeUsernameProblemLanguageResultExecution timeMemory
404068luisgalanDetecting Molecules (IOI16_molecules)C++14
0 / 100
1 ms204 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...