Submission #465248

#TimeUsernameProblemLanguageResultExecution timeMemory
465248dattranxxxDetecting Molecules (IOI16_molecules)C++11
9 / 100
1 ms204 KiB
/* * Author : shora */ #include <bits/stdc++.h> #define print(_v) for (auto &_ : _v) {cerr << _ << ' ';} cerr << endl; #include "molecules.h" using namespace std; using ll = long long; const int oo = 1e9; const int N = 1e4, U = 1e4; int dp[U + 1]; int n; vector<int> find_subset(int l, int u, vector<int> a) { n = a.size(); sort(a.begin(), a.end()); vector<int> res; for (int i = 0, j = 0, sum = 0; i < n;) { while (j < n && sum < l) { sum += a[j]; j++; } j--; if (sum >= l && sum <= u) { for (int k = i; k <= j; ++k) res.push_back(k); return res; } sum -= a[i]; i++; } return res; }
#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...