Advertisement
Guest User

TaskD

a guest
Oct 16th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. #define watch(x) cout << (#x) << " is " << (x) << endl
  6. #define pb push_back
  7. #define pow2(x) ((x)*(x))
  8. #define max3(a, b, c) max(a, max(b, c))
  9. #define min3(a, b, c) min(a, min(b, c))
  10. #define fr(i, n) for(int i = 0; i < int(n); ++i)
  11.  
  12. //#define int int64_t
  13.  
  14. //#define FIlE_in
  15. //#define FILE_out
  16.  
  17. #ifdef FIlE_in
  18. char file_in[]="C:\\Users\\pshpi\\OneDrive\\Desktop\\in.cpp";
  19. #endif // FIlE_in
  20. #ifdef FILE_out
  21. char file_out[]="C:\\Users\\pshpi\\OneDrive\\Desktop\\out.cpp";
  22. #endif // FILE_out
  23.  
  24. typedef long long ll;
  25.  
  26. const int INF=2e9;
  27. const ll INF64=1e18;
  28. const double PI=3.14159265359;
  29. const double EPS=1e-9;
  30. const int MOD=1e9+7;
  31.  
  32. template<typename type>
  33.  
  34. type next()
  35. {type x;cin>>x;return x;}
  36.  
  37. int next()
  38. {int x;cin>>x;return x;}
  39.  
  40. ll lnext()
  41. {ll x;cin>>x;return x;}
  42.  
  43. int main()
  44. {
  45. ios::sync_with_stdio(false);
  46. cin.tie(0);
  47. cout.tie(0);
  48.  
  49. #ifdef FIlE_in
  50. freopen(file_in, "r", stdin);
  51. #endif // FIlE_in
  52. #ifdef FILE_out
  53. freopen(file_out, "w", stdout);
  54. #endif // FILE_out
  55.  
  56. int n=next(), m=next();
  57. vector<vector<int> > gr(1e6+100);
  58. for (int i=0; i<m; i++){
  59. int x=next()-1, y=next()-1;
  60. gr[y].pb(x);
  61. }
  62. for (int i=0; i<n; i++){
  63. int a=next()-1, b=next()-1, c=next()-1;
  64. bool fl=false;
  65. if (gr[a].size()==0){
  66. if ( (gr[b].size()==1 && gr[b][0]==a) || gr[b].size()==0 ){
  67. if ( (gr[c].size()==2 && (gr[c][0]==a || gr[c][0]==b) && (gr[c][1]==a || gr[c][1]==b))
  68. || (gr[c].size()==1 && (gr[c][0]==a || gr[c][0]==b))
  69. || (gr[c].size()==0)
  70. )
  71. fl=true;
  72. }
  73. }
  74. if (fl) cout<<"honest\n";
  75. else cout<<"liar\n";
  76. }
  77.  
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement