/*** | |
Md. Nazmul Hasan | |
Shahjalal University of Science & Technology,Sylhet. | |
hasan08sust@gmail.com | |
***/ | |
#include<iostream> | |
#include<cstdio> | |
#include<stack> | |
#include<queue> | |
#include<map> | |
#include<vector> | |
#include<algorithm> | |
#include<cstring> | |
#include<sstream> | |
#include<cmath> | |
#include <iomanip> | |
using namespace std ; | |
typedef long long ll ; | |
typedef int in ; | |
typedef unsigned long long ull ; | |
const double pi = 2*acos(0) ; | |
#define maxi 40000 | |
#define pf printf | |
#define sc scanf | |
#define pb push_back | |
#define MEM(x,y) (memset((x),(y),sizeof(x))) | |
#define MIN(x,y) ((x) < (y) ? (x) : (y)) | |
#define MAX(x,y) ((x) > (y) ? (x) : (y)) | |
#define load(array,size) for(int i=0 ; i<size ; i++) cin>>array[i] ; | |
#define new_line pf("\n") | |
#define clear_data(array) memset(array,0,sizeof(array)) | |
#define highest_int 2147483647 | |
int main() | |
{ | |
int test,n,m,q,a,p,l,h; | |
map<int,string>map1; | |
map<int,int>map2; | |
map<int,int>map3; | |
vector<int>data; | |
string str; | |
sc("%d",&test); | |
while(test--) | |
{ | |
sc("%d",&p); | |
for(int i=1;i<=p ; i++) | |
{ | |
cin>>str>>l>>h; | |
data.pb(l); | |
map1[i] = str; | |
map2[i] = h; | |
map3[i]=l; | |
} | |
sc("%d",&q); | |
int k; | |
for(int i=1 ; i<=q ; i++) | |
{ | |
sc("%d",&a); | |
l=0; | |
int got=0; | |
for(int j=0 ; j<data.size() ; j++) | |
{ | |
n = data[j]; | |
k = j+1; | |
m = map2[k]; | |
if(a>=n && a<=m) | |
{ | |
//pf("Datas are %d %d",n,m); | |
//cout<<map1[n]<<endl; | |
got=j+1;; | |
l++; | |
} | |
//l++; | |
} | |
if(l>1 || l==0) | |
pf("UNDETERMINED\n"); | |
else if(l==1) | |
cout<<map1[got]<<endl; | |
} | |
data.clear(); | |
map1.clear(); | |
map2.clear(); | |
if(test) | |
pf("\n"); | |
} | |
return 0; | |
} | |
/* | |
2 | |
3 | |
ami 10000 20000 | |
tumi 10000 25000 | |
she 10000 12000 | |
2 | |
12000 | |
24000 | |
*/ |
13 November 2017
UVA 1237 Expert Enough?
Subscribe to:
Post Comments (Atom)
-
/*** Md. Nazmul Hasan Shahjalal University of Science & Technology,Sylhet. hasan08sust@gmail.com ***/ #include<iostream> #i...
-
n = 1 while n: str = input () # print('Case no# %d :'%n) if str == ' * ' : break if str == ' Hajj ...
-
/*** Md. Namzul Hasan Shahjalal University of Science & technology,sylhet. hasan08sust@gmail.com ***/ #include<bits/stdc++.h...
No comments:
Post a Comment