# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
54146 | 2018-07-02T13:15:50 Z | MoNsTeR_CuBe | Detecting Molecules (IOI16_molecules) | C++17 | 0 ms | 0 KB |
#include "molecules.h" #include <bits/stdc++.h> #define int long long using namespace std; vector<int> find_subset(int l, int r, vector<int> w){ int n = w.size(); int sum = 0; int right = -1; for(int i = 0; i < n; i++){ for(int j = right; j < n; j++){ if(j != right) sum += w[j]; //cout << sum << endl; if(sum >= l && sum <= r){ vector<int> v(0); for(int k = i; k <= j; k++){ v.push_back(k); } return v; } right = j; if(sum > r){ sum -= w[i]; break; } } } vector<int> v(0); return v; } /* signed main(){ int a, b, c; cin >> a >> b >> c; vector<int> v(0); for(int i = 0; i < a; i++){ int d; cin >> d; v.push_back(d); } v = find_subset(b,c,v); cout << v.size() << endl; for(int i = 0; i < v.size(); i++){ cout << v[i] << ' '; } cout << endl; } */