1 #include <cstdio>
2 #include <cstring>
3 #include <vector>
4 #include <algorithm>
5 #include <set>
6 #include <iostream>
7 using namespace std;
8 const int MAX = 1e5+10;
9 double a[MAX];
10 int main() {
11 int n,m,k;
12 while(scanf("%d %d %d",&n,&k,&m)==3) {
13 a[0]=0;
14 for(int i=1;i<=n;i++) {
15 cin>>a[i];
16 }
17 double res1=0,res2=0;
18 double last1=-1,last2=-1;
19 bool last=true;
20 int x=max(k,m);
21 for(int i=1;i<=n;i++) {
22 res1+=a[i];
23 res2+=a[i];
24 if(i>=m) res1-=a[i-m];
25 if(i>=k) res2-=a[i-k];
26 if(i <= x){
27 if(i==1) {
28 printf("silent");
29 }
30 else {
31 printf(" silent");
32 }
33 last1=res1/m;
34 last2=res2/k;
35 continue;
36 }
37 if(i<x) {
38 if(i==1) {
39 printf("silent");
40 }
41 else {
42 printf(" silent");
43 }
44 continue;
45 }
46 // printf("%lf %lf ",res2/k,res1/m);
47 if(last1>=last2&&res1*k<res2*m) {
48 if(i==1) {
49 printf("buy");
50 }
51 else {
52 printf(" buy");
53 }
54 }
55 else if(last1<=last2&&res1*k>res2*m) {
56 if(i==1) {
57 printf("sell");
58 }
59 else {
60 printf(" sell");
61 }
62 }
63 else {
64 if(i==1) {
65 printf("silent");
66 }
67 else {
68 printf(" silent");
69 }
70 }
71 last1=res1/m;
72 last2=res2/k;
73 }
74 printf(" ");
75 }
76 }
2 #include <cstring>
3 #include <vector>
4 #include <algorithm>
5 #include <set>
6 #include <iostream>
7 using namespace std;
8 const int MAX = 1e5+10;
9 double a[MAX];
10 int main() {
11 int n,m,k;
12 while(scanf("%d %d %d",&n,&k,&m)==3) {
13 a[0]=0;
14 for(int i=1;i<=n;i++) {
15 cin>>a[i];
16 }
17 double res1=0,res2=0;
18 double last1=-1,last2=-1;
19 bool last=true;
20 int x=max(k,m);
21 for(int i=1;i<=n;i++) {
22 res1+=a[i];
23 res2+=a[i];
24 if(i>=m) res1-=a[i-m];
25 if(i>=k) res2-=a[i-k];
26 if(i <= x){
27 if(i==1) {
28 printf("silent");
29 }
30 else {
31 printf(" silent");
32 }
33 last1=res1/m;
34 last2=res2/k;
35 continue;
36 }
37 if(i<x) {
38 if(i==1) {
39 printf("silent");
40 }
41 else {
42 printf(" silent");
43 }
44 continue;
45 }
46 // printf("%lf %lf ",res2/k,res1/m);
47 if(last1>=last2&&res1*k<res2*m) {
48 if(i==1) {
49 printf("buy");
50 }
51 else {
52 printf(" buy");
53 }
54 }
55 else if(last1<=last2&&res1*k>res2*m) {
56 if(i==1) {
57 printf("sell");
58 }
59 else {
60 printf(" sell");
61 }
62 }
63 else {
64 if(i==1) {
65 printf("silent");
66 }
67 else {
68 printf(" silent");
69 }
70 }
71 last1=res1/m;
72 last2=res2/k;
73 }
74 printf(" ");
75 }
76 }