Submission #134984

#TimeUsernameProblemLanguageResultExecution timeMemory
134984antimirageDetecting Molecules (IOI16_molecules)C++14
100 / 100
65 ms6252 KiB
#include "molecules.h" #include <bits/stdc++.h> #define fr first #define sc second #define pb push_back #define all(s) s.begin(), s.end() using namespace std; vector <int> ans; vector <pair <int, int> > w; vector<int> find_subset(int l, int r, vector<int> asd) { int j = 0; long long sum = 0; for (int i = 0; i < (int)asd.size(); i++) { w.pb({asd[i], i}); } sort(all(w)); for (int i = 0; i < (int)w.size(); i++) { sum += w[i].fr; while (j <= i && sum > r) { sum -= w[j].fr; j++; } if (sum >= l && sum <= r) { for (int k = j; k <= i; k++) { ans.pb(w[k].sc); } return 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...