Advertisement
Guest User

Untitled

a guest
Jan 27th, 2020
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. ifstream fin("veriflant.in");
  5. ofstream fout("veriflant.out");
  6.  
  7. int a[101][101], k, n, m, l[101 * 101];
  8.  
  9. int main()
  10. {
  11. fin >> n >> m;
  12. int x, y;
  13. while (m--)
  14. {
  15. fin >> x >> y;
  16. a[x][y] = a[y][x] = 1;
  17. }
  18. fin >> k;
  19. while (k--)
  20. {
  21. int lg = 0;
  22. fin >> lg;
  23. for (int i = 1; i <= lg; ++i)
  24. fin >> l[i];
  25. bool v[101] = {false};
  26. bool lant = true;
  27. bool elementar = true;
  28. v[l[1]] = true;
  29. for (int i = 2; i <= lg; ++i)
  30. {
  31. if (a[l[i - 1]][l[i]] == 0)
  32. {
  33. lant = false;
  34. break;
  35. }
  36. if (v[l[i]])
  37. elementar = false;
  38. v[l[i]] = true;
  39. }
  40. if (!lant)
  41. fout << "NU" << '\n';
  42. else
  43. {
  44. if (elementar)
  45. fout << "ELEMENTAR" << '\n';
  46. else
  47. fout << "NEELEMENTAR" << '\n';
  48. }
  49. }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement