Submission #875717

#TimeUsernameProblemLanguageResultExecution timeMemory
875717Elvin_FritlDetecting Molecules (IOI16_molecules)C++17
9 / 100
0 ms600 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 1e5 + 545 , inf = 1e9 + 199; #include "molecules.h" vector<int> find_subset(int left, int right, vector<int> w){ ll n = w.size(); ll l = 0 , r = 0; ll sum = 0; vector<pair<ll,ll>>a(n); for(int i=0;i<n;i++) { a[i].first = w[i]; a[i].second = i; } sort(a.begin() , a.end()); vector<int> res; for(int i=0;i<n;i++) { assert(l <= r); if(l < r && sum >= left && sum <= right){ break; } else if(sum < left && r < n) { sum += a[r++].first; } else{ sum -= a[l++].first; } } if(sum < left || sum > right) { return res; } for(int i=l;i<r;i++){ res.push_back(a[i].second); } 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...