//MH RIYAD
//lan:c++
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<string>
#include<map>
#include<algorithm>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<vector>
#include<stack>
#define inf 1<<31
using namespace std;
int main()
{
vector<int>vc;
int ary[500];
int per, bud, hotel, week;
while (cin >> per >> bud >> hotel >> week)
{
int weekendprice;
int p = 0;
while (hotel--)
{
cin>>weekendprice;
for (int i = 0; i < week; i++) cin >> ary[i];
for (int i = 0; i < week; i++)
{
if (ary[i] >= per)
{
p = 1;
vc.push_back(weekendprice*per);
break;
}
}
}
//cout << vc[0] << endl;
if (p == 0) printf("stay home\n");
else
{
sort(vc.begin(), vc.end());
if (vc[0]>bud)
printf("stay home\n");
else cout << vc[0] << endl;
}
vc.clear();
}
return 0;
}
//lan:c++
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<string>
#include<map>
#include<algorithm>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<vector>
#include<stack>
#define inf 1<<31
using namespace std;
int main()
{
vector<int>vc;
int ary[500];
int per, bud, hotel, week;
while (cin >> per >> bud >> hotel >> week)
{
int weekendprice;
int p = 0;
while (hotel--)
{
cin>>weekendprice;
for (int i = 0; i < week; i++) cin >> ary[i];
for (int i = 0; i < week; i++)
{
if (ary[i] >= per)
{
p = 1;
vc.push_back(weekendprice*per);
break;
}
}
}
//cout << vc[0] << endl;
if (p == 0) printf("stay home\n");
else
{
sort(vc.begin(), vc.end());
if (vc[0]>bud)
printf("stay home\n");
else cout << vc[0] << endl;
}
vc.clear();
}
return 0;
}
কোন মন্তব্য নেই:
একটি মন্তব্য পোস্ট করুন