Submission #228568

#TimeUsernameProblemLanguageResultExecution timeMemory
228568Haunted_CppRice Hub (IOI11_ricehub)C++17
68 / 100
1080 ms852 KiB
#include "ricehub.h" #include <bits/stdc++.h> using namespace std; int besthub(int R, int L, int X[], long long B) { int mx = 0; for (int i = 0; i < R; i++) { vector<int> dist; for (int j = 0; j < R; j++) { dist.emplace_back( abs (X[i] - X[j] ) ); } sort (dist.begin(), dist.end()); long long cur = B; int got = 0; for (int i = 0; i < R; i++) { if (cur - dist[i] >= 0) { cur -= dist[i]; ++got; } else break; } mx = max (mx, got); } return mx; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...