제출 #948341

#제출 시각아이디문제언어결과실행 시간메모리
948341SyriusDetecting Molecules (IOI16_molecules)C++14
0 / 100
1 ms500 KiB
#include <bits/stdc++.h> using namespace std; // #define int long long #define pint pair < int , int > #define ll long long #define ff first #define ss second #define fast ios_base::sync_with_stdio(NULL); cin.tie(NULL) const int inf = 1e9 + 9; const int mxn = 2e5 + 2; const int mod = 1e9 + 7; vector < int > find_subset(int l , int r , vector < int > w) { int n = w.size(); vector < pint > v; for (int i = 0; i < n; i++) { v.push_back({w[i] , i}); } sort(v.begin() , v.end()); vector < int > ans , rep; int sum = 0 , id1 = 0; while (id1 < n) { sum += v[id1].ff; ans.push_back(v[id1].ss); if (sum >= l) break; id1++; } if (sum <= r) return ans; if (id1 == n) { ans.clear(); return ans; } sum -= v[id1].ss; ans.pop_back(); id1--; int id2 = n-1; while (id1 >= 0 && id2 > id1) { sum += v[id2].ss - v[id1].ss; ans.pop_back(); rep.push_back(v[id2].ss); id2--; id1--; if (sum >= l && sum <= r) { for (int i : rep) ans.push_back(i); return ans; } } ans.clear(); return ans; }
#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...