# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
972317 | 2024-04-30T10:49:46 Z | Tanos | Detecting Molecules (IOI16_molecules) | C++17 | 0 ms | 0 KB |
#include <bits/stdc++.h> using namespace std; #define ll long long #define x first #define y second #define all(x) x.begin(), x.end() #define el "\n" #define pb push_back #define pp pop_back #define pii pair <int, int> #define pll pair <ll, ll> #define ibase ios_base::sync_with_stdio(0), cin.tie(0); const int N = 5e5 + 5, M = 1e3 + 5, pw = 31; const ll MAX = 1e15, inf = 1e9 + 7; vector <int> find_subset(int l, int u, int a[]) { int n = sizeof a; pair <int, int> p[n]; for (int i = 0; i <= n; i++) { p[i] = {a[i], i + 1}; } ll sum = 0, j = 0, last = 0; for (int i = 0; i < n; i++) { sum += p[i].x; last = i; if (sum >= l && sum <= u) { break; } else if (sum >= l) { int j = 0; while (sum > u) sum -= p[j++].x; break; } } vector <int> ans; for (int i = j; i <= last; i++) ans.pb(i); return ans; } //void solve() { // // //} //int main() { // ibase; // int T = 1; //// cin >> T; // for (int test = 1; test <= T; ++test) { //// cout << " " << test << ":" << el; // solve(); // cout << el; // } //}