正方形の2つの頂点を決めてしまってから、残りの2頂点が存在するかを二分探索する #include <cstdio> #include <algorithm> using namespace std; #define X first #define Y second typedef pair<int, int> P; int N; P stars[1000]; int main(){ while(scanf("%d", &N) && N != 0){ int </int,></algorithm></cstdio>…