-
Notifications
You must be signed in to change notification settings - Fork 0
/
201604.cpp
67 lines (67 loc) · 1.19 KB
/
201604.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<vector>
using namespace std;
int a1[40001],b1[40001],c1[40001],d1[40001],x[40001],y[40001];
int main()
{
//freopen("magic.in","r",stdin);
//freopen("magic.out","w",stdout);
int n,m,j;
vector<int> k;
cin>>n>>m;
for(int i=1;i<=m;i++)
{
cin>>x[i];
y[i]=x[i];
}
sort(x+1,x+m+1);
for(int i=1;i<=m;i++)
{
if(x[i]!=x[i-1])
k.push_back(x[i]);
}
j=k.size();
for(int a=0;a<j-3;a++)
for(int b=a+1;b<j-2;b++)
for(int c=b+1;c<j-1;c++)
for(int d=c+1;d<j;d++)
{
if((k[b]-k[a]==2*(k[d]-k[c]))&&(k[b]-k[a]<(k[c]-k[b])*1.0/3))
{
for(int i=1;i<=m;i++)
{
if(y[i]==k[a])
{
a1[i]++;
}
}
for(int i=1;i<=m;i++)
{
if(y[i]==k[b])
{
b1[i]++;
}
}
for(int i=1;i<=m;i++)
{
if(y[i]==k[c])
{
c1[i]++;
}
}
for(int i=1;i<=m;i++)
{
if(y[i]==k[d])
{
d1[i]++;
break;
}
}
}
}
for(int i=1;i<=m;i++)
cout<<a1[i]<<" "<<b1[i]<<" "<<c1[i]<<" "<<d1[i]<<endl;
return 0;
}