text: Example Input 4 3 3 1 2 2 3 3 1 3 6 1 2 2 1 2 3 3 2 1 3 3 1 7 10 1 2 2 3 3 1 1 4 4 5 5 1 4 6 6 7 7 4 6 1 6 8 1 2 2 3 3 4 4 5 5 6 6 1 6 2 5 1 Output 1 2 3 -1 1 2 3 5 -1 Note In all drawings, if a city is colored green, then it is interesting; otherwise, it is colored red.In the first sample, each city is interesting.<image> In the second sample, no city is interesting.<image> In the third sample, cities 1, 2, 3 and 5 are interesting.<image> In the last sample, only the city 1 is interesting.It is strictly less than 20\% of all cities, so the answer is -1.<image> # Solution #include <bits/stdc++.h> using namespace std; mt19937 gene(233); inline char GET_CHAR() { const int maxn = 131072; static char buf[maxn], *p1 = buf, *p2 = buf; return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, maxn, stdin), p1 == p2) ?EOF : *p1++; } inline int getInt() { int res(0); char c = getchar(); while (c < '0') c = getchar(); while (c >= '0') { res = res * 10 + (c - '0'); c = getchar(); } return res; } inline long long fastpo(long long x, long long n, long long mod) { long long res(1); while (n) { if (n & 1) { res = res * (long long)x % mod; } x = x * (long long)x % mod; n /= 2; } return res; } inline string itoa(int x, int width = 0) { string res; if (x == 0) res.push_back('0'); while (x) { res.push_back('0' + x % 10); x /= 10; } while ((int)res.size() < width) res.push_back('0'); reverse(res.begin(), res.end()); return res; } template <const long long mod> struct MI { long long a; MI operator+(const MI& b) { MI res{a + b.a}; if (res.a >= mod) res.a -= mod; return res; } MI operator-(const MI& b) { MI res{a - b.a}; if (res.a <= 0) res.a += mod; return res; } MI operator*(const MI& b) { return MI{a * b.a % mod}; } MI operator/(const MI& b) { return MI{a * fastpo(b.