Submission #953850

#TimeUsernameProblemLanguageResultExecution timeMemory
953850emad234Detecting Molecules (IOI16_molecules)C++17
10 / 100
1 ms444 KiB
#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) { int n = w.size(); int R = n - 1; int num = w[n - 1]; vector<int>ans; if(num >= l && num <= u) return {num}; for(int i = n - 2;i >= 0;i--){ if(num > u){ num -= w[R]; R--; } 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...