Submission #591350

#TimeUsernameProblemLanguageResultExecution timeMemory
591350FatihSolakDetecting Molecules (IOI16_molecules)C++17
19 / 100
1 ms340 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; vector<int> find_subset(int l, int r, vector<int> w) { vector<int> ans; int n = w.size(); vector<pair<int,int>> v; for(int i = 0;i<n;i++){ v.push_back({w[i],i}); } long long sum = 0; for(int i = 0;i<=n;i++){ if(i) sum += v[i-1].first; long long tmp = sum; for(int j = n;j>=i;j--){ if(j != n) tmp += v[j].first; if(l <= tmp && tmp <= r && ans.empty()){ for(int c = 0;c<i;c++){ ans.push_back(v[c].second); } for(int c = n-1;c>=j;c--){ ans.push_back(v[c].second); } } } } 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...