Submission #253206

#TimeUsernameProblemLanguageResultExecution timeMemory
253206nandonathanielDetecting Molecules (IOI16_molecules)C++14
100 / 100
68 ms5624 KiB
#include "molecules.h" #include<bits/stdc++.h> using namespace std; typedef pair<int,int> pii; pii arr[200000]; vector<int> find_subset(int l, int u, vector<int> w) { int n=w.size(); for(int i=0;i<n;i++)arr[i]={w[i],i}; sort(arr,arr+n); int ptr=0; long long tot=0; vector<int> ans; for(int i=0;i<n;i++){ while(ptr<n && tot<l){ tot+=arr[ptr].first; ptr++; } if(tot>=l && tot<=u){ for(int j=i;j<ptr;j++)ans.push_back(arr[j].second); break; } tot-=arr[i].first; } 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...