1237:Expert Enough?

 

Problem Link

#Solution

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

int main() {

int t;
int n,m;
cin>>t;
while(t–)
{

cin>>n;
string s[n];
int lw[n],hi[n];
for(int i=0;i<n;i++)
{cin>>s[i]>>lw[i]>>hi[i];
}
cin>>m;int pos;
for(int i=0;i<m;i++)
{int x;
int flag=0;
cin>>x;
for(int i=0;i<n;i++)
{
if(lw[i]<=x &&hi[i]>=x)
{
flag++;pos=i; }
if(flag>1)
break;

}
if(flag==1)
cout<<s[pos]<<endl;
else
puts(“UNDETERMINED”);
flag=0;
}
if(t) cout<<endl;
}

}

Advertisements

About waprogramming

I am in CSE,from CUET
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s