Submission #556262

#TimeUsernameProblemLanguageResultExecution timeMemory
556262Talha_TakiDetecting Molecules (IOI16_molecules)C++17
10 / 100
1 ms340 KiB
#include <bits/stdc++.h> #include "molecules.h" using namespace std; typedef long long ll; typedef pair <int, int> pii; std::vector<int> find_subset(int l, int u, std::vector<int> w) { vector <int> ret; int n = w.size(); vector <pii> W(n); for(int i = 0; i < n; ++i) { W[i] = {w[i], i}; } sort(W.begin(), W.end()); bool flag = true; for(int i = 0; flag && i < n; ++i) { for(int j = i+1; flag && j < n; ++j) { ll sum = 0; for(int k = i; k <= j; ++k) { sum += W[k].first; } if (l <= sum && sum <= u) { flag = false; for(int k = i; k <= j; ++k) { ret.push_back(W[k].second); } } } } return ret; }
#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...