제출 #813427

#제출 시각아이디문제언어결과실행 시간메모리
813427petezaDetecting Molecules (IOI16_molecules)C++14
9 / 100
1 ms304 KiB
#include <bits/stdc++.h> #include "molecules.h" using namespace std; vector<int> find_subset(int l, int u, vector<int> w) { int n = w.size(); vector<pair<int, int>> vec(n); for(int i=0;i<n;i++) vec[i] = {w[i], i}; sort(vec.begin(), vec.end()); vector<long long> qs(1, 0); for(auto e:vec) qs.push_back(qs.back()+e.first); for(auto it = qs.begin(); it != qs.end(); it++) { auto i2 = lower_bound(qs.begin(), qs.end(), *it + l); if(i2 == qs.end()) return vector<int>(0); if(*i2 - *it <= u) { vector<int> vec; for(++it,++i2;it!=i2;it++) vec.push_back(it-qs.begin()-1); return vec; } } return vector<int>(0); } /* int main() { auto e = find_subset(10, 20, {15, 16, 17, 18}); for(auto E:e) cout << E << ' '; }*/
#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...