제출 #385974

#제출 시각아이디문제언어결과실행 시간메모리
385974ismoilovDetecting 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 < r && r <= n) { if(ans < l1 && r < n) { ans += w[r], r ++, s.insert(r-1); //continue; } if(ans > u) 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...