Submission #647195

#TimeUsernameProblemLanguageResultExecution timeMemory
647195tigarDetecting Molecules (IOI16_molecules)C++14
9 / 100
1 ms340 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; vector<int> find_subset(int l, int u, vector<int>w) { int n=w.size(); sort(w.begin(), w.end()); vector<int>result; long long sums[n+1]; sums[0]=(ll)0; for(int i=1; i<=n; i++)sums[i]=(ll)w[i-1]+sums[i-1]; for(int i=1, j=1; i<=n;) { int sum=sums[i]-sums[j-1]; if(sum>=l and sum<=u) { for(int k=j-1, l=0; k<i; k++, l++)result.push_back(k); break; } else if(sum<l)i++; else if(sum>u)j++; } return result; }
#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...