Submission #929231

#TimeUsernameProblemLanguageResultExecution timeMemory
929231MatblubeDetecting Molecules (IOI16_molecules)C++14
100 / 100
42 ms5860 KiB
#include "molecules.h" #include <iostream> #include <iomanip> #include <string> #include <math.h> #include <algorithm> #include <cstring> #include <numeric> #include <vector> #include <bitset> #include <map> #include <set> #include <queue> #include <deque> #include <stack> #include <unordered_map> #include <unordered_set> using namespace std; typedef long long ll; #define dbg(x) cerr<<#x<<": "<<x<<"\n"; /* one piece paceño */ vector<int> find_subset(int l, int u, vector<int> w){ int n=(int)w.size(); vector<int>ans; vector<pair<int, int>>v(n); for(int i=0 ; i<n ; i++){ v[i].first=w[i]; v[i].second=i; } sort(v.begin(), v.end()); int i=-1, j=-1; long long mn=0; while(1|!0){ if(mn<l){ j++; if(j>=n) break; mn+=v[j].first; }else if(mn>u){ i++; if(i>=j) break; mn-=v[i].first; }else{ for(int k=i+1 ; k<=j ; k++) ans.push_back(v[k].second); return ans; } } return 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...