Submission #378004

#TimeUsernameProblemLanguageResultExecution timeMemory
378004hackermubDetecting Molecules (IOI16_molecules)C++17
69 / 100
1056 ms12152 KiB
#include "molecules.h" #include<bits/stdc++.h> using namespace std; //#define int long long #define pii pair<int,int> #define float long double #define fi first #define se second #define pb push_back #define all(v) v.begin(),v.end() #define sz(v) (int)v.size() std::vector<int> find_subset(int l, int u, std::vector<int> w) { int n=sz(w); vector<int> idx(n); iota(all(idx),0); sort(all(idx),[w](int a,int b)->bool{ return w[a]<w[b]; }); int L=0,sum=0; for(int R=0;R<n;R++){ if(w[idx[R]]>u) break; sum+=w[idx[R]]; while(L<=R && sum>u){ sum-=w[idx[L]]; L++; } assert(L<=R); if(sum>=l) return vector<int>(idx.begin()+L,idx.begin()+R+1); } 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...