제출 #486705

#제출 시각아이디문제언어결과실행 시간메모리
486705Jarif_RahmanDetecting Molecules (IOI16_molecules)C++17
0 / 100
1 ms292 KiB
#include "molecules.h" #include <bits/stdc++.h> #define pb push_back #define f first #define sc second using namespace std; typedef long long int ll; typedef string str; vector<int> find_subset(int l, int u, vector<int> w){ int n = w.size(); vector<int> s(n); for(int i = 0; i < n; i++) s[i] = i; sort(s.begin(), s.end(), [&](int a, int b){ return w[a] < w[b]; }); ll sum = 0; vector<int> ans; int i = 0, j = 1; sum = w[s[0]]; for(;j < n; j++){ sum+=w[s[j]]; while(sum >= u) sum-=w[s[i]], i++; if(sum >= l && sum <= u) break; } if(sum < l || sum > u) return ans; for(int k = i; k <= j; k++) ans.pb(s[k]); return ans; }
#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...