Submission #385965

#TimeUsernameProblemLanguageResultExecution timeMemory
385965ismoilovDetecting Molecules (IOI16_molecules)C++14
0 / 100
1089 ms24428 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 && r < n) { ans += w[r], r ++, s.insert(r-1); //continue; } while(ans > u && l < n) ans -= w[l], l ++, s.erase(l-1); if(ans >= l1 && ans <= u) break; cout << l << " " << r << " " << ans << "\n"; } if(ans > u || ans < l1) s.erase(all(s)); vector <int> x; for(auto it : s) x.pb(it); 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...