제출 #651356

#제출 시각아이디문제언어결과실행 시간메모리
651356ayallaDetecting Molecules (IOI16_molecules)C++14
0 / 100
1 ms212 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; #define ll long long int vector<int> find_subset(int l, int u, vector<int> w) { int r = u; int n = w.size(); vector<pair<ll, int>> s; for (int i = 0; i < n; i++) s.push_back({w[i], i}); sort(s.begin(), s.end()); vector<bool> vis(n, 1); vector<int> ans; int sum = 0, j = 0; for (int i = 0; i < n; i++) { while (j < n && sum < l) { sum += s[j].first; vis[s[j].second] = 1; j++; } if (sum >= l && sum <= r) { for (int i = 0; i < n; i++) { if (vis[i]) ans.push_back(i); } break; } sum -= s[i].first; vis[s[i].second] = 0; } 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...