Submission #699931

#TimeUsernameProblemLanguageResultExecution timeMemory
699931elkernosDetecting Molecules (IOI16_molecules)C++17
9 / 100
1 ms300 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; #define ssize(x) (int)size(x) vector<int> find_subset(int l, int u, vector<int> w) { vector<pair<int, int>> pairs(ssize(w)); for (int i = 0; i < ssize(w); i++) pairs[i] = {w[i], i}; sort(pairs.begin(), pairs.end()); vector<ll> sum(ssize(w) + 1); for (int i = 0; i < ssize(w); i++) sum[i + 1] = sum[i] + pairs[i].first; for (int i = 1; i <= ssize(w); i++) { int where = lower_bound(sum.begin(), sum.begin() + i, sum[i] - u) - sum.begin(); if (sum[i] - sum[where] >= l) { vector<int> wyp; for (int j = where + 1; j <= i; j++) wyp.push_back(pairs[j].second); return wyp; } } return vector<int>(); }
#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...