Submission #639965

#TimeUsernameProblemLanguageResultExecution timeMemory
639965pere_gilDetecting Molecules (IOI16_molecules)C++17
0 / 100
0 ms300 KiB
#include "molecules.h" #include "bits/stdc++.h" using namespace std; typedef long long ll; #define ii pair<ll,ll> vector<int> find_subset(int l, int u, vector<int> w) { int n=(int)w.size(); vector<ii> v(n); for(int i=0;i<n;i++) v[i]={w[i],i}; sort(v.begin(),v.end()); int i=0,j=0; ll sum=0; while(sum<l || sum>u){ if(sum<l){ if(j==n) break; sum+=w[j]; j++; } else{ if(i>j) break; sum-=w[i]; i++; } } if(sum<l || sum>u) return vector<int> (); vector<int> res; for(int k=i;k<j;k++) res.push_back(v[k].first); 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...