Monday, May 1, 2017

URI Solution 1410 He is Offside! - Solution in C++ | Ad Hoc

URI Solution 1410 He is Offside! - Solution in C++ | Ad Hoc


URI Online Judge Solution  1410 He is Offside | Ad Hoc
URI Main Problem Link - https://www.urionlinejudge.com.br/judge/en/problems/view/1410

Problem Name: URI Problem 1410 He is Offside
Problem Number : URI Problem 1410 Solution
Online Judge : URI Online Judge Solution
Level: Ad Hoc
Solution Language : C plus plus

URI Solution 1410 Code in CPP:


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
 int a, d, tmp;

 while((cin >> a >> d) && a != 0 && d != 0)
 {
  vector<int> forA;
  vector<int> forB;

  for (int i = 0; i < a; ++i)
  {
   cin >> tmp;
   forA.push_back(tmp);
  }

  for (int i = 0; i < d; ++i)
  {
   cin >> tmp;
   forB.push_back(tmp);
  }

  sort(forA.begin(), forA.begin() + a);
  sort(forB.begin(), forB.begin() + d);

  if(forA[0] < forB[1]){
   cout << "Y" << endl;
  }else{
   cout << "N" << endl;
  }

 }

 return 0;
}

No comments:
Write comments

To know more about the problem, give us your valuable commment. We'll try to help you. Thanks

All rights reserved ©2016 -URI ONLINE JUDGE SOLUTION | Developed by Maniruzzaman Akash

© 2016 URI ONLINE JUDGE SOLUTION. Developed by Maniruzzaman Akash | Distributed By Gooyaabi Templates
Powered by Blogger.