Skip to content
Programmingoneonone
Programmingoneonone
  • Home
  • CS Subjects
    • IoT ? Internet of Things
    • Digital Communication
    • Human Values
  • Programming Tutorials
    • C Programming
    • Data structures and Algorithms
    • 100+ Java Programs
    • 100+ C Programs
  • HackerRank Solutions
    • HackerRank Algorithms Solutions
    • HackerRank C problems solutions
    • HackerRank C++ problems solutions
    • HackerRank Java problems solutions
    • HackerRank Python problems solutions
Programmingoneonone

HackerEarth Prom Night problem solution

YASH PAL, 31 July 2024
In this HackerEarth Prom Night problem solution, The Hexagon University of India will be hosting its Prom Night tonight.There would be M boys and N girls at the prom tonight. Each boy wants a girl who is strictly shorter than him. A girl can dance with only one boy and vice-versa. Given the heights of all the boys and girls tell whether it is possible for all boys to get a girl.
HackerEarth Prom Night problem solution

HackerEarth Prom Night problem solution.

#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(0);
using namespace std;
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define mp make_pair
#define all(a) a.begin(),a.end()
#define bitcnt(x) __builtin_popcountll(x)
#define MOD 1000000007
#define total 5000005
#define M 1000000000001
#define NIL 0
#define MAXN 200001
#define EPS 1e-5
#define INF (1<<28)
typedef unsigned long long int uint64;
typedef long long int int64;
vector<int>b,g;
int main(){
int t,j,n,m,i;
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
cin>>t;
while(t--){
b.clear();
g.clear();
cin>>n>>m;
for(i=0;i<n;i++){
cin>>j;
b.pb(j);
}
for(i=0;i<m;i++){
cin>>j;
g.pb(j);
}
sort(all(b));
sort(all(g));
j=0;
for(i=0;i<m;i++){
if(j==n)
break;
if(g[i]<b[j]){
j++;
continue;
}
}
if(j==n)
printf("YESn");
else
printf("NOn");
}
fclose(stdout);
return 0;
}
coding problems solutions

Post navigation

Previous post
Next post

Pages

  • About US
  • Contact US
  • Privacy Policy

Programing Practice

  • C Programs
  • java Programs

HackerRank Solutions

  • C
  • C++
  • Java
  • Python
  • Algorithm

Other

  • Leetcode Solutions
  • Interview Preparation

Programming Tutorials

  • DSA
  • C

CS Subjects

  • Digital Communication
  • Human Values
  • Internet Of Things
  • YouTube
  • LinkedIn
  • Facebook
  • Pinterest
  • Instagram
©2025 Programmingoneonone | WordPress Theme by SuperbThemes