# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
769362 | Mery2005 | Detecting Molecules (IOI16_molecules) | C++14 | 3 ms | 980 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <algorithm>
#include <queue>
#include <cmath>
#include <vector>
#include <list>
#include <string>
#include <unordered_map>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <iomanip>
#include <fstream>
using namespace std;
void fastio() {
ios_base::sync_with_stdio(false);
cin.tie(0);
}
const long long mod = 1e9+7;
const int N = 3e5+5;
int a[N] , dp[N];
vector<int> find_subset(int l, int u, vector<int> w){
vector<pair<int , int>> w1;
for(int i = 0 ; i < w.size() ; i++){
w1.push_back({w[i] , i});
}
sort(w1.begin() , w1.end());
int ind = 0;
long long int s = 0;
for(int i = 0 ; i < w.size() ; i++){
while(s < l){
s += w1[ind].first;
ind++;
}
if(s >= l && s <= u){
vector<int> res;
for (int j = i; j < ind; j++) {
res.push_back(w1[j].second);
}
return res;
}
s -= w1[i].first;
}
return vector<int>(0);
}
// int main(){
// vector<int> ans = find_subset(15, 17, {6, 8, 8, 7});
// for(auto x : ans){
// cout << x << endl;
// }
// return 0;
// }
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |