Holi and Miss Ural | Problem Code: HOLIURAL

                     

In a far away Galaxy of Tilky Way, there was a planet Tarth where the sport of Tompetitive Toding was very popular. According to legends, there lived a setter known for making long problem statements on Holi.

Miss Ural wants to buy colors for Holi, and that too, at the cheapest cost!!

There are N shops selling colors near Ural’s house, where the i′thi′th shop sells colors at rate of RiRi for one unit. Also, i′thi′th shop is located at a distance of DiDi kilometres from her house. Life was simple, but then petrol and fuel prices soared up. The current price of petrol to travel one kilometer is KK.

Find the minimum cost at which Miss Ural can buy one unit of color. Note that she does not need to return back home

Solution :

#include <bits/stdc++.h>
using namespace std;
#define int long long int
signed main()
{
  int in;
  cin>>in;
  while(in--)
  {
    int no_shop,petrol;
    cin>>no_shop>>petrol;
    int distance[no_shop];
    int shop[no_shop];
    int final[no_shop];
    for(int i=0;i<no_shop;++i)
    {
      cin>>distance[i];
    }
    for(int j=0;j<no_shop;++j)
    {
      cin>>shop[j];
    }
    for(int k=0;k<no_shop;++k)
    {
      final[k]=distance[k]*petrol+shop[k];
    }
    int n = sizeof(final) / sizeof(final[0]);
    cout<< *min_element(final, final + n)<<endl;
  }
}