Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- struct data
- {
- char maker[23];
- int low,high;
- } database[10005];
- int main()
- {
- int test,koyta,khojo,i,j,query;
- char store[23];
- scanf("%d",&test);
- while(test--)
- {
- scanf("%d",&koyta);
- for(i=1; i<=koyta; i++)
- {
- scanf("%s%d%d",database[i].maker,&database[i].low,&database[i].high);
- }
- scanf("%d",&query);
- while(query--)
- {
- scanf("%d",&khojo);
- int cnt = 0;
- for(i=1; i<=koyta; i++)
- {
- if(khojo>=database[i].low && khojo<=database[i].high)
- {
- cnt++;
- strcpy(store,database[i].maker);
- }
- }
- if(cnt==1)
- {
- printf("%s\n",store);
- }
- else
- {
- printf("UNDETERMINED\n");
- }
- }
- if(test>0)
- {
- puts("");
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment