제출 #330292

#제출 시각아이디문제언어결과실행 시간메모리
330292gouravkhungerDetecting Molecules (IOI16_molecules)C++14
19 / 100
1 ms492 KiB
#include <bits/stdc++.h> using namespace std; vector<int> find_subset(int l, int u, vector<int> w) { int size = w.size(); vector<pair<int,int>> p(size); for(int i=0;i<size;i++)p[i]={w[i], i}; int left=0,right=0,sum=p[0].first; while(left<size||right<size){ if(sum<l){ right++; if(right>=size) break; sum+=p[right].first; } else if(sum>u){ if(left>=size) break; sum-=p[left].first; left++; } else break; } if(l<=sum&&sum<=u){ vector<int> ans; for(int i=left;i<=right;i++) ans.push_back(p[i].second); return ans; } else 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...