#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream f("stdin");
ofstream g("stdout");
int n, m, i, j, k, x, v[102]={0};
f>>n>>m>>k>>x;
for(i=1; i<=n; i++){
f>>j;
v[i]=j;
f>>j;
v[i]=v[i]+m*j;
}
k=k*m;
for(i=1; i<=n; i++){
for(j=1; j<n; j++){
if(v[j]<=v[j+1])
swap(v[j], v[j+1]);
}
}
for(i=1; i<=k; i++){
v[1]=v[1]-x;
j=1;
while(v[j]<v[j+1]&&j<=n){
swap(v[j], v[j+1]);
j++;
}
}
x=v[1];
for(i=2; i<=n; i++){
if(v[i]>x){
x=v[i];
}
}
for(i=1; i<=n; i++){
cout<<v[i]<<" ";
}
g<<x;
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/8 | ||||||
1 | Wrong answer | 1ms | 320 KiB | ||||
subtask2 | 0/22 | ||||||
1 | Wrong answer | 1ms | 320 KiB | ||||
2 | Wrong answer | 1ms | 332 KiB | ||||
3 | Wrong answer | 1ms | 500 KiB | ||||
4 | Wrong answer | 1ms | 320 KiB | ||||
5 | Wrong answer | 1ms | 320 KiB | ||||
6 | Wrong answer | 1ms | 320 KiB | ||||
7 | Wrong answer | 1ms | 320 KiB | ||||
8 | Wrong answer | 1ms | 320 KiB | ||||
9 | Wrong answer | 1ms | 320 KiB | ||||
subtask3 | 0/43 | ||||||
1 | Wrong answer | 1ms | 320 KiB | ||||
2 | Wrong answer | 1ms | 320 KiB | ||||
3 | Wrong answer | 1ms | 320 KiB | ||||
4 | Wrong answer | 1ms | 508 KiB | ||||
5 | Wrong answer | 1ms | 352 KiB | ||||
6 | Wrong answer | 1ms | 552 KiB | ||||
7 | Wrong answer | 1ms | 320 KiB | ||||
8 | Wrong answer | 1ms | 320 KiB | ||||
9 | Wrong answer | 1ms | 556 KiB | ||||
10 | Wrong answer | 1ms | 372 KiB | ||||
subtask4 | 0/27 | ||||||
1 | Wrong answer | 1ms | 320 KiB | ||||
2 | Wrong answer | 1ms | 408 KiB | ||||
3 | Wrong answer | 1ms | 324 KiB | ||||
4 | Wrong answer | 1ms | 320 KiB | ||||
5 | Wrong answer | 1ms | 320 KiB | ||||
6 | Wrong answer | 1ms | 320 KiB | ||||
7 | Wrong answer | 1ms | 320 KiB | ||||
8 | Wrong answer | 1ms | 320 KiB | ||||
9 | Wrong answer | 1ms | 320 KiB | ||||
10 | Wrong answer | 1ms | 320 KiB | ||||
11 | Wrong answer | 1ms | 320 KiB |