Submission #953870

#TimeUsernameProblemLanguageResultExecution timeMemory
953870emad234Detecting Molecules (IOI16_molecules)C++17
0 / 100
1 ms600 KiB
#include "molecules.h" #include <bits/stdc++.h> #define ll long long #define F first #define S second #define pii pair<ll, ll> const ll mod = 1e9 + 7; const ll mxN = 1e6 + 5; using namespace std; std::vector<int> find_subset(int l, int u, std::vector<int> w) { sort(w.begin(), w.end()); int n = w.size(); int R = n - 1; ll num = w[n - 1]; vector<int> ans; for (int i = n - 2; i >= 0; i--) { if (num >= l && num <= u) { for (int j = i + 1; j <= R; j++) ans.push_back(j); return ans; } if (num > u) { num -= w[R]; R--; } if (num >= l && num <= u) { for (int j = i + 1; j <= R; j++) ans.push_back(j); return ans; } num += w[i]; if (num >= l && num <= u) { for (int j = i; j <= R; j++) ans.push_back(j); return ans; } } return {}; }
#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...