Submission #725592

#TimeUsernameProblemLanguageResultExecution timeMemory
725592HaroldVemenoDetecting Molecules (IOI16_molecules)C++17
9 / 100
1 ms212 KiB
#include <bits/stdc++.h> #ifdef GUDEB #define D(x) cerr << #x << ": " << (x) << '\n'; #define ifdeb if(true) #else #define D(x) ; #define ifdeb if(false) #endif #define all(x) begin(x), end(x) using namespace std; using ull = unsigned long long; using ll = long long; // #define int ll; vector<int> find_subset(int l, int u, vector<int> ws) { sort(all(ws)); int n = ws.size(); ll s = 0; int be = n; int eb = n; for(int i = 0; i < n; ++i) s += ws[i]; while(true) { if(s > u) { if(be == 0) return {}; --be; s -= ws[be]; } else if(s < l) { if(eb == be) return {}; --eb; s += ws[eb]; } else { vector<int> res{}; for(int i = 0; i < be; ++i) res.push_back(i); for(int i = eb; i < n; ++i) res.push_back(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...