Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- ifstream fin("veriflant.in");
- ofstream fout("veriflant.out");
- int a[101][101], k, n, m, l[101 * 101];
- int main()
- {
- fin >> n >> m;
- int x, y;
- while (m--)
- {
- fin >> x >> y;
- a[x][y] = a[y][x] = 1;
- }
- fin >> k;
- while (k--)
- {
- int lg = 0;
- fin >> lg;
- for (int i = 1; i <= lg; ++i)
- fin >> l[i];
- bool v[101] = {false};
- bool lant = true;
- bool elementar = true;
- v[l[1]] = true;
- for (int i = 2; i <= lg; ++i)
- {
- if (a[l[i - 1]][l[i]] == 0)
- {
- lant = false;
- break;
- }
- if (v[l[i]])
- elementar = false;
- v[l[i]] = true;
- }
- if (!lant)
- fout << "NU" << '\n';
- else
- {
- if (elementar)
- fout << "ELEMENTAR" << '\n';
- else
- fout << "NEELEMENTAR" << '\n';
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement