제출 #502125

#제출 시각아이디문제언어결과실행 시간메모리
502125MurotYDetecting Molecules (IOI16_molecules)C++14
100 / 100
48 ms5188 KiB
#include <bits/stdc++.h> #define ll long long #define ff first #define ss second #include "molecules.h" using namespace std; std::vector<int> find_subset(int l, int u, std::vector<int> w) { vector <pair <ll,ll> > a(w.size()); int n=w.size(); for (int i=0;i<n;i++) a[i].first=w[i], a[i].second=i; sort(a.begin(),a.end()); long long sum=0, q=0; for (int i=0;i<n;i++){ while (q < n && sum < l) sum+=a[q].first, q++; if (sum >= l && sum <= u and u-l >= a[n-1].first-a[0].first){ vector <int> ans; for (int j=i;j<q;j++) ans.push_back(a[j].second); sort(ans.begin(), ans.end()); return ans; } sum-=a[i].first; } return vector <int> (); }
#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...