Submission #788447

#TimeUsernameProblemLanguageResultExecution timeMemory
788447BulaDetecting Molecules (IOI16_molecules)C++17
69 / 100
34 ms4948 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define all(x) x.begin(),x.end() #define rall(x) x.rbegin(),x.rend() //#define int ll const ll mod=1e9+7; vector<int> find_subset(int l,int u,vector<int> w){ int n = (int) w.size(); vector< pair<int,int> > v(n); for(int i=0;i<n;i++){ v[i].first = w[i]; v[i].second = i; } sort(all(v)); int j=0,sum=0; for(int i=0;i<n;i++){ sum+=v[i].first; while(sum > u && j < i){ sum-=v[j].first; j++; } if(l <= sum && sum <= u){ vector<int> ans; for(int o=j;o<=i;o++) ans.pb(v[o].second); return ans; } } return {}; }
#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...