Submission #862044

#TimeUsernameProblemLanguageResultExecution timeMemory
862044culver0412Detecting Molecules (IOI16_molecules)C++17
100 / 100
37 ms5732 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; vector<int> find_subset(int l, int u, vector<int> w) { int siz=w.size(); pair<int,int> arr[siz]; for(int i=0;i<siz;i++){ arr[i]={w[i],i}; } sort(arr,arr+siz); long long int sum1=0,sum2=0; vector<int> ans; for(int i=0;i<siz;i++){ sum1+=arr[i].first; sum2+=arr[siz-i-1].first; if(!(sum1<=u&&l<=sum2)){ continue; } int j=i; while(sum1<l){ sum1-=arr[j-i].first; j++; sum1+=arr[j].first; } for(int k=j-i;k<=j;k++){ ans.push_back(arr[k].second); } return ans; } 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...