제출 #841061

#제출 시각아이디문제언어결과실행 시간메모리
841061manhlinh1501Detecting Molecules (IOI16_molecules)C++17
69 / 100
1066 ms5892 KiB
#include <bits/stdc++.h> using namespace std; using i64 = long long; using pii = pair<int,int>; using pli = pair<i64,int>; #define sz(a) (int)a.size() #define eb emplace_back #define all(a) a.begin(),a.end() vector<int> find_subset(int l, int r, vector<int> a){ int n = sz(a); vector<pii> res; for(int i=0;i<n;i++) res.eb(a[i],i); sort(all(res)); vector<pli> sum(n+1,{0,0}); for(int i=0;i<n;i++){ sum[i+1].first=sum[i].first+res[i].first; sum[i+1].second=res[i].second; } vector<int> ans; for(int i=1;i<=n;i++){ for(int j=i;j<=n;j++){ i64 res=sum[j].first-sum[i-1].first; if(l<=res and res<=r){ for(int k=i;k<=j;k++) ans.eb(sum[k].second); sort(all(ans)); return ans; } } } sort(all(ans)); 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...