Submission #1105876

#TimeUsernameProblemLanguageResultExecution timeMemory
1105876abushbandit_Detecting Molecules (IOI16_molecules)C++17
0 / 100
1 ms504 KiB
#include "molecules.h" #include "bits/stdc++.h" std::vector<int> find_subset(int a, int b, std::vector<int> w) { sort(w.begin(),w.end()); int n = w.size(); int resr = 0,resl = 1; int l = 0; int ans = 0; int sum = 0; for(int r = 0;r < n;r++) { sum += w[r]; if(sum < a) { continue; } while(sum > b && l <= r) { sum -= w[l]; l++; } if(sum >= a && sum <= b) { if(ans < r - l + 1) { ans = r - l + 1; resr = r,resl = l; } } } std::vector<int> res; for(int i = resl;i <= resr;i++) { res.push_back(w[i]); } return res; }
#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...