Submission #836089

#TimeUsernameProblemLanguageResultExecution timeMemory
836089oscar1fDetecting Molecules (IOI16_molecules)C++17
100 / 100
49 ms8260 KiB
#include<bits/stdc++.h> #include "molecules.h" using namespace std; using ll=long long; ll nbVal,minSom,maxSom,deb,fin,somCour; vector<pair<ll,ll>> listePoids; vector<int> rep; vector<int> find_subset(int l,int u,vector<int> w) { minSom=l; maxSom=u; nbVal=w.size(); for (ll i=0;i<nbVal;i++) { listePoids.push_back({w[i],i}); } sort(listePoids.begin(),listePoids.end()); fin=nbVal-1; deb=nbVal; while (deb>0 and somCour<minSom) { deb--; somCour+=listePoids[deb].first; } if (somCour<minSom) { return rep; } while (deb>0 and somCour>maxSom) { somCour-=listePoids[fin].first; fin--; deb--; somCour+=listePoids[deb].first; } if (somCour<=maxSom) { for (int i=deb;i<=fin;i++) { rep.push_back(listePoids[i].second); } } return rep; }
#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...