Submission #841062

#TimeUsernameProblemLanguageResultExecution timeMemory
841062manhlinh1501Detecting Molecules (IOI16_molecules)C++17
9 / 100
1 ms212 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<i64> sum(n+1,0); for(int i=0;i<n;i++) sum[i+1]=sum[i]+res[i].first; vector<int> ans; for(int i=1;i<=n;i++){ for(int j=i;j<=n;j++){ i64 temp=sum[j]-sum[i-1]; if(l<=temp and temp<=r){ for(int k=i;k<=j;k++) ans.eb(res[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...