제출 #997675

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