Submission #265840

#TimeUsernameProblemLanguageResultExecution timeMemory
265840amallaDetecting Molecules (IOI16_molecules)C++17
100 / 100
70 ms5624 KiB
#include "molecules.h" #include<bits/stdc++.h> using namespace std; #define ll long long vector<int> find_subset(int l, int u, vector<int> w) { int N = w.size(); vector<pair<int,int>> A(N); for (int i = 0; i<N; ++i) { A[i].first = w[i]; A[i].second = i; } sort(A.begin(), A.end()); ll sum = 0; queue<int> q; for (int i = 0; i<N; ++i) { sum += A[i].first; q.push(A[i].second); while (sum>u) { sum -= w[q.front()]; q.pop(); } if (sum>=l) { vector<int> Ans(q.size()); int j = 0; while(!q.empty()) { Ans[j] = q.front(); q.pop(); ++j; } return Ans; } } return vector<int>(0); }
#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...