Submission #794785

#TimeUsernameProblemLanguageResultExecution timeMemory
794785baneDetecting Molecules (IOI16_molecules)C++17
9 / 100
13 ms304 KiB
#include<bits/stdc++.h> #include "molecules.h" using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); vector<int> find_subset(int L, int u, vector<int> k) { int n = (int)k.size(); vector<pair<int,int>>w(n); for (int i = 0; i < n; i++){ w[i] = {k[i], i}; } for (int i = 0; i < 10000; i++){ shuffle(w.begin(),w.end(),rng); int l = 0, r = 0; long long s = 0; while(r < n){ s += w[r].first; while(s > u){ s -= w[l].first; ++l; } if (s >= L && s <= u){ vector<int>ans; while(l<=r){ ans.push_back(w[l].second); ++l; } return ans; } ++r; } } return std::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...