Submission #486702

#TimeUsernameProblemLanguageResultExecution timeMemory
486702Jarif_RahmanDetecting Molecules (IOI16_molecules)C++17
0 / 100
1 ms204 KiB
#include <bits/stdc++.h> #define pb push_back #define f first #define sc second using namespace std; typedef long long int ll; typedef vector <int> v_i; vector<int> find_subset(int l, int u, vector<int> w){ int n = w.size(); vector <pair<int, int>> v; for(int i = 0; i < n; i++) v.pb({w[i], i}); sort(v.begin(), v.end()); bool b = false; ll s = 0; int inl = 0, inr = -1; for(int i = 0; i < n; i++){ s+=v[i].f, inr++; if(s > u) while(s > u) s-= v[inl].f, inl++; if(s >= l && s <= u){ b = true; break; } } vector<int> ans; if(!b) return ans; else{ for(int i = 0; i <= inr-inl+1; i++) ans.pb(v[inl+i].sc); 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...