class Solution { public: bool canAchieveMinimumDifference(const vector& start, int d, long long minDiff) { int n = start.size(); vector chosen(n, 0); chosen[0] = start[0]; for (int i = 1; i < n; ++i) { long long lowerBound = start[i]; long long upperBound = start[i] + d; if (chosen[i - 1] + minDiff upperBound) return false; } else return false; } return true; } int maxPossibleScore(vector& start, int d) { int n = start.size(); vector sorted_start = start; sort(sorted_start.begin(), sorted_start.end()); long long left = 0; long long right = sorted_start.back() + d - sorted_start.front(); long long result = 0; while (left
Пікірлер: 1