Friday 25 September 2015

UVA 11559 Event Planning

///     Raihan Ruhin
///     CSE, Jahangirnagar University.
///     Dhaka-Bangladesh.
///     id: raihanruhin (topcoder / codeforces / codechef / uva / uvalive / spoj), 3235 (lightoj)
///     mail: raihanruhin@ (yahoo / gmail / facebook)
///     blog: ruhinraihan.blogspot.com

#include<bits/stdc++.h>
using namespace std;

#define SET(a) memset(a,-1,sizeof(a))
#define CLR(a) memset(a,0,sizeof(a))
#define PI acos(-1.0)

#define MOD 1000000007
#define MX 100010


int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);
    int tc, kk=1, n, b, h, w, p, x;
    string s;
    char ch;
    while(cin>>n>>b>>h>>w)
    {
        int mn=1e9;
        for(int i=0;i<h;i++)
        {
            cin>>p;
            for(int j=0;j<w;j++)
            {
                cin>>x;
                if(x>=n)
                    mn = min(mn, n*p);
            }
        }
        if(mn>b)     cout<<"stay home\n";
        else cout<<mn<<"\n";
    }
return 0;
}

1 comment:

  1. Thanks for the post and great tips..even I also think that hard work is the most important aspect of getting success.. event technical production company

    ReplyDelete