ccf-201803-2
#include <iostream>
#include <cstring>
using namespace std;
struct ball {
int dir;
int loc;
};
int n,l,t;
void find(ball *b,int j) {
for(int i=0; i<n; i++) {
if(b[i].loc==j) {
b[i].dir=-b[i].dir;
}
}
}
int main() {
cin>>n>>l>>t;
ball *b=new ball[n];
int ll[l+1];
for(int i=0; i<n; i++) {
b[i].dir=1;
cin>>b[i].loc;
}
for(int i=0; i<t; i++) {
memset(ll,0,sizeof(ll));
for(int j=0; j<n; j++) {
b[j].loc+=b[j].dir;
ll[b[j].loc]++;
}
for(int j=0; j<l+1; j++) {
if(ll[j]==2||j==0&&ll[j]==1||j==l&&ll[j]==1) {
find(b,j);
}
}
}
for(int j=0; j<n; j++) {
cout<<b[j].loc<<" ";
}
cout<<endl;
return 0;
}