Submission #1104529

#TimeUsernameProblemLanguageResultExecution timeMemory
1104529ngano_upat_naDetecting Molecules (IOI16_molecules)C++17
9 / 100
35 ms588 KiB
#pragma GCC optimize("O1,O2,O3,Ofast,unroll-loops") #include "bits/stdc++.h" #include "molecules.h" using namespace std; using ll = long long; vector<int> find_subset(int l, int u, vector<int> w) { srand(time(0)); int n = (int)w.size(); ll sum = 0; for (int i=0; i<n; i++) { sum += (ll)w[i]; } if (sum == u) { vector<int> res; for (int i=0; i<n; i++) { res.push_back(i); } return res; } if (sum < l) { return {}; } for (int i=0; i<5000; i++) { set<int> s; for (int j=0; j<n; j++) { int r = rand()%n; s.insert(r); } sum = 0; for (auto &e:s) { sum += w[e]; } if (l <= sum && sum <= u) { vector<int> res; for (auto &e:s) { res.push_back(e); } return res; } } return {}; }
#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...