Submission #815517

#TimeUsernameProblemLanguageResultExecution timeMemory
815517TheSahibDetecting Molecules (IOI16_molecules)C++14
9 / 100
1 ms304 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; vector<int> find_subset(int v, int u, vector<int> w) { int n = w.size(); long long sum = 0; vector<pair<int, int>> arr; for (int i = 0; i < n; i++) { arr.push_back({w[i], i}); } sort(arr.begin(), arr.end()); int l = 0, r = 0; while(l <= r){ if(sum > u){ if(l == r) return {}; sum -= w[l]; l++; } else if(sum < v){ if(r == n){ return {}; } sum += w[r]; r++; } else{ break; } } vector<int> ans; for(int i = l; i < r; ++i){ ans.push_back(arr[i].second); } return ans; }
#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...