제출 #639967

#제출 시각아이디문제언어결과실행 시간메모리
639967pere_gilDetecting Molecules (IOI16_molecules)C++17
100 / 100
43 ms7152 KiB
#include "molecules.h" #include "bits/stdc++.h" using namespace std; typedef long long ll; #define ii pair<ll,ll> vector<int> find_subset(int l, int u, vector<int> w) { int n=(int)w.size(); vector<ii> v(n); for(int i=0;i<n;i++) v[i]={w[i],i}; sort(v.begin(),v.end()); int i=0,j=0; ll sum=0; while(sum<l || sum>u){ if(sum<l){ if(j==n) break; sum+=v[j].first; j++; } else{ if(i>j) break; sum-=v[i].first; i++; } } if(sum<l || sum>u) return vector<int> (); vector<int> res; for(int k=i;k<j;k++) res.push_back(v[k].second); return res; }
#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...