Submission #385950

#TimeUsernameProblemLanguageResultExecution timeMemory
385950ismoilovDetecting Molecules (IOI16_molecules)C++14
0 / 100
1 ms364 KiB
#include "molecules.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; #define all(x) (x).begin(), (x).end() #define fp(a,i,c) for(int (a) = (i); (a) < (c); (a)++) #define pb push_back vector<int> find_subset(int l1, int u, vector<int> w) { int n = w.size(), ans = 0; set <int> s; sort(all(w)); int l = 0, r = 0; while(l < n && r < n) { while(ans < l1) { ans += w[r], r ++, s.insert(r-1); } if(ans >= l1 && ans <= u) break; while(ans > u) ans -= w[l], l ++, s.erase(l-1); } if(ans > u || ans < l1) s.erase(all(s)); vector <int> x; for(auto it : s) x.pb(it+1); return x; }
#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...