Submission #501444

#TimeUsernameProblemLanguageResultExecution timeMemory
501444MurotYDetecting Molecules (IOI16_molecules)C++14
9 / 100
1 ms204 KiB
#include <bits/stdc++.h> #define ll long long #include "molecules.h" using namespace std; std::vector<int> find_subset(int l, int u, std::vector<int> w) { vector <int> a; a=w; int n=a.size(); pair <ll, ll> jv; jv.first=jv.second=-1; ll res=1e9; int mx=0, mn=1e9; for (int i=0;i<n;i++){ mx=max(mx, a[i]); mn=min(mn, a[i]); for (int j=i;j<n;j++){ ll sum=0; for (int j1=i;j1<=j;j1++){ sum+=a[i]; } if (sum >= l and sum <= u){ if (res > (j-i+1)){ res=j-i+1; jv.first=i; jv.second=j; } } } } vector <int> ans; if (jv.first == -1 or mx-mn > u-l); else { for (int i=jv.first;i<=jv.second;i++) ans.push_back(i); } // for (auto l:ans) cout << l <<" "; return ans; // return std::vector<int>(0); }
#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...