제출 #465254

#제출 시각아이디문제언어결과실행 시간메모리
465254dattranxxxDetecting Molecules (IOI16_molecules)C++11
0 / 100
1 ms224 KiB
/* * Author : shora */ #include <bits/stdc++.h> #define print(_v) for (auto &_ : _v) {cerr << _ << ' ';} cerr << endl; #include "molecules.h" using namespace std; using ll = long long; const int oo = 1e9; struct P { int x = 0, i = 0; bool operator < (const P& p) { return x < p.x; } }; vector<int> find_subset(int l, int u, vector<int> v) { int n = v.size(); vector<P> a(n); for (int i = 0; i < n; ++i) a[i].x = v[i], a[i].i = i; sort(a.begin(), a.end()); vector<int> res; for (int i = 0, j = 0, sum = 0; i < n;) { while (j < n && sum < l) { sum += a[j].x; j++; } j--; if (sum >= l && sum <= u) { for (int k = i; k <= j; ++k) res.push_back(a[i].i); return res; } sum -= a[i].x; i++; } return res; }
#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...