제출 #593560

#제출 시각아이디문제언어결과실행 시간메모리
593560Valaki2Detecting Molecules (IOI16_molecules)C++14
19 / 100
2 ms340 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back const vector<int> e = {}; int n; vector<ll> v; ll a, b; vector<int> construct(int l, int r) { vector<int> result; for(int i = l; i <= r; i++) { result.pb(i - 1); } return result; } vector<int> solve() { ll sum = 0, len = -1; for(int i = 1; i <= n; i++) { sum += v[i]; if(sum >= a) { if(sum <= b) { return construct(1, i); } len = i - 1; break; } } if(len == -1) { return e; } sum = 0; int l = 1, r = len; for(int i = 1; i <= len; i++) { sum += v[i]; } while(r <= n) { if(sum >= a && sum <= b) { return construct(l, r); } sum -= v[l]; l++; r++; sum += v[r]; } return e; } vector<int> find_subset(int l, int u, vector<int> w) { n = w.size(); v.assign(1 + n + 1, 0); for(int i = 1; i <= n; i++) { v[i] = w[i - 1]; } a = l; b = u; return solve(); }
#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...