代码:
#include<bits/stdc++.h>
using namespace std;
struct node {
long long int a, b, c, d;
long long int x;
};
node sum[400001] = {};
int main() {
long long int n, m;
cin >> n >> m;
for (int i = 1; i <= m; i++) {
cin >> sum[i].x;
}
for (int a = 1; a <= m; a++) {
for (int b = 1; b <= m; b++) {
for (int c = 1; c <= m; c++) {
for (int d = 1; d <= m; d++) {
if (sum[b].x - sum[a].x == 2 * (sum[d].x - sum[c].x) && sum[b].x - sum[a].x < (sum[c].x - sum[b].x) / 3.0) {
if (a != b && b != c && c != d && a != c && b != d && a != d) {
if (sum[a].x < sum[b].x && sum[b].x < sum[c].x && sum[c].x < sum[d].x) {
sum[a].a++;
sum[b].b++;
sum[c].c++;
sum[d].d++;
continue;
}
}
}
}
}
}
}
for (int i = 1; i <= m; i++) {
cout << sum[i].a << " " << sum[i].b << " " << sum[i].c << " " << sum[i].d << "\n";
}
return 0;
}
