Submission #783898

#TimeUsernameProblemLanguageResultExecution timeMemory
783898AlfraganusDetecting Molecules (IOI16_molecules)C++14
19 / 100
1 ms304 KiB
#include "molecules.h" // #include "grader.cpp" #include<bits/stdc++.h> using namespace std; #define all(x) (x).begin(), (x).end() vector<int> find_subset(int l, int u, vector<int> w) { vector<int> ans; int mn = *min_element(all(w)), k = count(all(w), mn); for(int i = 0; i <= k; i ++){ int t = i * mn; if(u < t)break; if(l <= t and t <= u){ for(int j = 0; j < (int)w.size(); j ++){ if(w[j] == mn and i > 0){ ans.push_back(j); i --; } if(i == 0)break; } break; } int left = (l - t + mn) / (mn + 1); if(left > (int)w.size() - k or t + left * (mn + 1) > u)continue; for(int j = 0; j < (int)w.size(); j ++){ if(w[j] == mn and i > 0){ ans.push_back(j); i --; } if(w[j] == mn + 1 and left > 0){ ans.push_back(j); left --; } } break; } return ans; }
#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...