Advertisement
Chap4ev

D1

Oct 17th, 2019
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.28 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <utility>
  4. using namespace std;
  5.  
  6. bool check(pair <vector<int>, vector<int>> film1,
  7.            pair <vector<int>, vector<int>> film2,
  8.            pair <vector<int>, vector<int>> film3,
  9.            int n1, int n2, int n3){
  10.     if (film1.first.empty() &&
  11.         film2.first.size() <= 1 &&
  12.         film3.first.size() <= 2){
  13.         if (film2.first.size() == 1)
  14.             if (film2.first[0] != n1)
  15.                 return false;
  16.         for(int i = 0; i < film3.first.size(); i++){
  17.             if (film3.first[i] != n1 && film3.first[i] != n2)
  18.                 return false;
  19.         }
  20.         return true;
  21.     }else{
  22.         return false;
  23.     }
  24. }
  25.  
  26. int main() {
  27.     int girls_count, films_count;
  28.     cin >> girls_count >> films_count;
  29.  
  30.     // vector <bool> ans(girls_count);
  31.     vector <pair <vector<int>, vector<int>>> films_rating (films_count+1);
  32.     int f1, f2, f3;
  33.     for (int i = 0; i != films_count; i++) {
  34.         cin >> f1 >> f2;
  35.         films_rating[f1].second.push_back(f2);
  36.         films_rating[f2].first.push_back(f1);
  37.     }
  38.     for (int i = 0; i != girls_count; i++) {
  39.         cin >> f1 >> f2 >> f3;
  40.         cout << (check(films_rating[f1], films_rating[f2], films_rating[f3], f1, f2, f3)
  41.                  ? "honest" : "liar") << endl;
  42.     }
  43.     return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement