immuntasir

1237

Feb 27th, 2015
308
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.15 KB | None | 0 0
  1. #include <cstdio>
  2. #include <vector>
  3. #include <iostream>
  4. #include <cstring>
  5. #include <string>
  6. using namespace std;
  7. int main() {
  8.     std::ios_base::sync_with_stdio(false);
  9.     int T;
  10.     cin >> T;
  11.     while (T--) {
  12.         vector <string> names;
  13.         vector <int> erNicheDimuNaVai;
  14.         vector <int> erEkTakaoBeshiDimuNa;
  15.  
  16.         int noc,noq,query,i,j,k,x,y,z;
  17.         string str;
  18.         cin >> noc;
  19.  
  20.         for (z=0;z<noc;z++) {
  21.             cin >> str >> i >> j;
  22.             names.push_back(str);
  23.             erNicheDimuNaVai.push_back(i);
  24.             erEkTakaoBeshiDimuNa.push_back(j);
  25.         }
  26.  
  27.  
  28.         int selected[2];
  29.         cin >> noq;
  30.  
  31.         while (noq--) {
  32.             cin >> query;
  33.             int cnt=0;
  34.             for (i=0;i<noc&&cnt<2;i++) {
  35.                 if (query>=erNicheDimuNaVai[i] && query <= erEkTakaoBeshiDimuNa[i]) {
  36.                     selected[cnt] = i;
  37.                     cnt++;
  38.                 }
  39.             }
  40.             x=selected[0];
  41.             if (cnt==1) cout << names[x] << "\n";
  42.             else printf("UNDETERMINED\n");
  43.         }
  44.         if (T>0) printf("\n");
  45.     }
  46.     return 0;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment