Submission #396320

#TimeUsernameProblemLanguageResultExecution timeMemory
396320iulia13Detecting Molecules (IOI16_molecules)C++14
0 / 100
40 ms6748 KiB
#include <iostream> #include <algorithm> #include "molecules.h" #include <vector> using namespace std; #define ll long long const int nmax = 2e5 + 5; struct ura{ ll x; int ind; }; ura v[nmax]; bool cmp(ura a, ura b) { if (a.x > b.x) return false; return true; } vector <int> ans; vector <int> find_subset(int l, int r, vector <int> a) { int n = a.size(), i, j; for (i = 1; i <= n; i++) { v[i].x = a[i - 1]; v[i].ind = i - 1; } sort(v + 1, v + n + 1, cmp); for (i = 1; i <= n; i++) v[i].x += v[i - 1].x; i = 0; j = 1; for (j = 1; j <= n; j++) { while (v[j].x - v[i].x > r) i++; if (v[j].x - v[i].x >= l) { for (int h = i + 1; h <= j; h++) ans.push_back(v[h].ind); return ans; } } return ans; }/* vector <int> eh; int main() { int l, r, n, i; cin >> l >> r >> n; while(n--) { int nr; cin >> nr; eh.push_back(nr); } vector <int> an = find_subset(l, r, eh); for (i = 0; i < an.size(); i++) cout << an[i] << " "; return 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...