Although the tag says Greedy for the problem, I don’t see how it can be solved in a greedy fashion.
For a greedy algorithm, at each iteration, you should be able to choose the biggest or best - hence the algorithm name - and those choices should lead to an optimum solution.
In this problem, you sometimes need to include a distant camp with small gold and power (i.e. not a greedy choice) because there’s a lot of gold and power in a camp beyond it.
If you have an O(N^2) solution that gives WA (and not TLE), I’d see if you can find the problem with it.
Disclaimer: I’ve not solved this, so perhaps I’m talking rubbish. Perhaps someone else can point out what I’m missing.