あとで
class MinimumSquare { public: long long minArea(vector <int> x, vector <int> y, int K) { int N=x.size(); vector<int> X(x); sort(ALL(X)); ll ans = 1LL<<60; //REP(x0, N) RANGE(x1, x0+1, N) { // だめじゃった REP(x0, N) RANGE(x1, x0, N) { ll W = abs(X[x0]-X[x1])+2; VI Y; REP(i, N) if(X[x0]<=x[i] && x[i]<=X[x1]) Y.PB(y[i]); sort(ALL(Y)); int M=Y.size(); REP(i, Y.size()) { if(i+K-1>=M) break; ll H = abs(Y[i]-Y[i+K-1])+2; ans = min(ans, max(W, H)); } } return ans*ans; } };