Submission #1062553

#TimeUsernameProblemLanguageResultExecution timeMemory
1062553TsotneSVDetecting Molecules (IOI16_molecules)C++14
69 / 100
31 ms4956 KiB
#include <bits/stdc++.h> using namespace std; /* /\_/\ (= ._.) / > \> */ #define fi first #define se second vector<int> find_subset(int l, int u, vector<int> w) { int n = w.size(); pair<int,int> A[n]; for(int i=0;i<n;i++) A[i] = {w[i],i}; sort(A,A+n); int lo = 0,hi = 0,sum = 0; while(hi < n) { sum += A[hi++].fi; while(lo < hi and sum > u) sum -= A[lo++].fi; if(sum >= l and sum <= u) { vector<int> ret(hi - lo); for(int i=lo;i<hi;i++) ret[i-lo] = A[i].se; return ret; } } return vector<int>(0); }
#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...