wa
#pragma warning(disable:4996)
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<algorithm>
#include<iostream>
#include<time.h>
using namespace std;
const int INF = 0x3f3f3f3f;
struct node
{
int fish;
int decrease;
int ID;
int time;
}lake[30];
int route[30];
bool cmp1(node a, node b)
{
if (a.fish == b.fish)
return a.ID < b.ID;
return a.fish > b.fish;
}
bool cmp2(node a, node b)
{
return a.ID < b.ID;
}
int vs_main()
{
int n;
while (cin >> n, n)
{
int h;
cin >> h;
int Sum = h*12;//有多少个5分钟;
memset(lake, 0, sizeof(lake));
for (int i = 1; i <= n; i++)
{
cin >> lake[i].fish;
lake[i].ID = i;
}
for (int i = 1; i <= n; i++)
{
cin >> lake[i].decrease;
}
for (int i = 1; i <= n - 1; i++)
{
cin >> route[i];
Sum -= route[i];
}
int Count = 0;
int temp = 0;
while (Sum >=1)
{
sort(lake + 1, lake + n + 1, cmp1);
Count += lake[1].fish;
lake[1].fish -= lake[1].decrease;
if (lake[1].fish < 0)
lake[1].fish = 0;
if (lake[1].ID == temp)
{
Sum -= 2;
lake[1].time +=10;
}
else
{
Sum -= 1;
lake[1].time += 5;
}
temp = lake[1].ID;
}
sort(lake + 1, lake + n + 1, cmp2);
for (int i = 1;i<= n-1; i++)
{
printf("%d, ", lake[i].time);
}
printf("%d\n", lake[n].time);
printf("Number of fish expected: %d\n\n", Count);
}
return 0;
}
int main()
{
int start = clock();
freopen("in.txt", "r", stdin);
//freopen("out.txt","w",stdout);
printf("#===================#\n");
vs_main();
printf("#===================#\n");
printf("Time:%.3lf\n", double(clock() - start) / CLOCKS_PER_SEC);
//system("pause");
return 0;
}