Submission #841059

#TimeUsernameProblemLanguageResultExecution timeMemory
841059manhlinh1501Detecting Molecules (IOI16_molecules)C++17
19 / 100
1 ms212 KiB
#include <bits/stdc++.h> using namespace std; using i64 = long long; 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<pli> sum(n+1,{0,0}); for(int i=0;i<n;i++){ sum[i+1].first=sum[i].first+a[i]; sum[i+1].second=i; } 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); 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...