标签:lin cond i++ 因此 name typedef define def std
#include <cstdio>
#include <algorithm>
#include <set>
#define fir first
#define sec second
using namespace std;
typedef pair<int, int> pii;
const int maxn = 2e5 + 5;
int n, k;
pii p[maxn];
set<pii> s;
pii operator + (pii A, pii B) {
return {A.fir + B.fir, A.sec + B.sec};
}
bool operator == (pii A, pii B) {
return A.fir == B.fir && A.sec == B.sec;
}
bool operator < (pii A, pii B) {
if (A.fir != B.fir) return A.fir < B.fir;
return A.sec < B.sec;
}
void check(int l, int r) {
int cnt = 0;
pii point = p[l] + p[r];
l = 1, r = n;
while (l <= r) {
if (point == p[l] + p[r]) {
l++, r--;
} else if (point < p[l] + p[r]) {
cnt++, r--;
} else {
cnt++, l++;
}
}
if (cnt <= k)
s.insert(point);
}
int main() {
scanf("%d %d", &n, &k);
for (int i = 1; i <= n; i++)
scanf("%d %d", &p[i].fir, &p[i].sec);
if (n <= k) return !printf("-1\n");
sort(p + 1, p + 1 + n);
for (int i = 1; i <= k + 1; i++)
for (int j = n - k; j <= n; j++)
check(i, j);
printf("%d\n", (int)s.size());
for (auto i : s)
printf("%.8lf %.8lf\n", (double)i.fir / 2.0, (double)i.sec / 2.0);
}
标签:lin cond i++ 因此 name typedef define def std
原文地址:https://www.cnblogs.com/AlphaWA/p/10895778.html