Advertisement
Guest User

Alternative_ProblemD

a guest
Oct 16th, 2019
348
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.77 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. typedef long long ll;
  5. typedef pair <ll ,ll> pll;
  6. typedef pair <int ,int> pii;
  7. typedef pair <double , double> pt;
  8.  
  9. #define pb push_back
  10. #define eb emplace_back
  11. #define mp make_pair
  12. #define prar(a , n) {for (int iiiiiiiiii = 0; iiiiiiiiii < n; iiiiiiiiii++) cout << a[iiiiiiiiii] << ' '; cout << '\n';}
  13. #define inar(a , n) {for (int iiiiiiiiii = 0; iiiiiiiiii < n; iiiiiiiiii++) cin >> a[iiiiiiiiii];}
  14. #define prvc(a) {for (int iiiiiiiiii = 0; iiiiiiiiii < a.size(); iiiiiiiiii++) cout << a[iiiiiiiiii] << ' '; cout << '\n';}
  15. #define invc(a , n) {for (int iiiiiiiiii = 0; iiiiiiiiii < n; iiiiiiiiii++) a.pb(next());}
  16. #define fi first
  17. #define se second
  18.  
  19.  
  20. ll next() {ll x; cin >> x; return x;}
  21. const ll inf = 4e18 , mod = 1e9 + 7;
  22. const int intf = 1e9 , MaxN = 2e5;
  23. const double PI = 3.141592653589 , eps = 3;
  24.  
  25.  
  26. int main()
  27. {
  28.     #ifdef HERE
  29.         freopen("input.txt" , "r" , stdin);
  30.     #else
  31.         //freopen("forest.in" , "r" , stdin); freopen("forest.out" , "w" , stdout);
  32.         ios_base::sync_with_stdio(false);
  33.     #endif
  34.     cout.precision(20);
  35.  
  36.     int n = next() , m = next();
  37.  
  38.     vector <unordered_set<int> > a(1e6 + 1);
  39.  
  40.     for (int i = 0; i < m; i ++){
  41.         int x = next() , y = next();
  42.         a[y].insert(x);
  43.     }
  44.  
  45.     for (int i = 0; i < n; i ++){
  46.         int x = next() , y = next() , z = next();
  47.         bool ans = true;
  48.  
  49.         ans &= (a[x].size() == 0);
  50.         ans &= (a[y].size() == 0 || (a[y].size() == 1 && a[y].count(x)));
  51.         ans &= (a[z].size() == 0 || (a[z].size() == 1 && (a[z].count(x) || a[z].count(y))) || (a[z].size() == 2 && (a[z].count(x) && a[z].count(y))));
  52.  
  53.         if (ans) cout << "honest\n";
  54.         else cout << "liar\n";
  55.     }
  56.  
  57.     return 0;
  58. }
  59. /*
  60.  
  61. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement