Submission #1098293

#TimeUsernameProblemLanguageResultExecution timeMemory
10982930pt1mus23Detecting Molecules (IOI16_molecules)C++14
69 / 100
33 ms5680 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; #define ins insert #define pb push_back #define endl '\n' #define putr(x) cout<<x<<endl;return; #define all(x) x.begin(),x.end() #define _ << " " << vector<int> find_subset(int l, int u, vector<int> arr) { int n = arr.size(); vector<pair<int,int>> lst; for(int i=0;i<n;i++){ lst.pb({arr[i],i}); } sort(all(lst)); int lx=0; int rx=0; vector<int> ans; int sum=0; for(int i=0;i<n;i++){ rx=i; sum+=lst[i].first; while(sum>u){ sum-=lst[lx].first; lx++; } if(sum<=u && sum>=l){ for(int j=lx;j<=rx;j++){ ans.pb(lst[j].second); } 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...