Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define gc getchar_unlocked
- #define fo(i, n) for (i = 0; i < n; i++)
- #define ll long long
- #define si(x) scanf("%d", &x)
- #define sl(x) scanf("%lld", &x)
- #define ss(s) scanf("%s", s)
- #define pi(x) printf("%d\n", x)
- #define pl(x) printf("%lld\n", x)
- #define ps(s) printf("%s\n", s)
- #define deb(x) cout << #x << "=" << x << endl
- #define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
- #define pb push_back
- #define mp make_pair
- #define F first
- #define S second
- #define all(x) x.begin(), x.end()
- #define getunique(v) \
- { \
- sort(v.begin(), v.end()); \
- v.erase(unique(v.begin(), v.end()), v.end()); \
- }
- #define clr(x) memset(x, 0, sizeof(x))
- #define sortall(x) sort(all(x))
- #define tr(it, a) for (auto it = a.begin(); it != a.end(); it++)
- #define PI 3.1415926535897932384626
- typedef pair<int, int> pii;
- typedef pair<ll, ll> pl;
- typedef vector<int> vi;
- typedef vector<ll> vl;
- typedef vector<pii> vpii;
- typedef vector<pl> vpl;
- typedef vector<vi> vvi;
- typedef vector<vl> vvl;
- namespace number_theory
- {
- ll gcd(ll x, ll y)
- {
- if (x == 0)
- return y;
- if (y == 0)
- return x;
- return gcd(y, x % y);
- }
- bool isprime(ll n)
- {
- if (n <= 1)
- return false;
- if (n <= 3)
- return true;
- if (n % 2 == 0 || n % 3 == 0)
- return false;
- for (ll i = 5; i * i <= n; i += 6)
- if (n % i == 0 || n % (i + 2) == 0)
- return false;
- return true;
- }
- bool prime[15000105];
- void sieve(int n)
- {
- for (ll i = 0; i <= n; i++)
- prime[i] = 1;
- for (ll p = 2; p * p <= n; p++)
- {
- if (prime[p] == true)
- {
- for (ll i = p * p; i <= n; i += p)
- prime[i] = false;
- }
- }
- prime[1] = prime[0] = 0;
- }
- vector<ll> primelist;
- bool __primes_generated__ = 0;
- void genprimes(int n)
- {
- __primes_generated__ = 1;
- sieve(n + 1);
- for (ll i = 2; i <= n; i++)
- if (prime[i])
- primelist.push_back(i);
- }
- vector<ll> factors(ll n)
- {
- if (!__primes_generated__)
- {
- cerr << "Call genprimes you dope" << endl;
- exit(1);
- }
- vector<ll> facs;
- for (ll i = 0; primelist[i] * primelist[i] <= n && i < primelist.size(); i++)
- {
- if (n % primelist[i] == 0)
- {
- while (n % primelist[i] == 0)
- {
- n /= primelist[i];
- facs.push_back(primelist[i]);
- }
- }
- }
- if (n > 1)
- {
- facs.push_back(n);
- }
- sort(facs.begin(), facs.end());
- return facs;
- }
- vector<ll> getdivs(ll n)
- {
- vector<ll> divs;
- for (ll i = 1; i * i <= n; i++)
- {
- if (n % i == 0)
- {
- divs.push_back(i);
- divs.push_back(n / i);
- }
- }
- getunique(divs);
- return divs;
- }
- }
- using namespace number_theory;
- mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
- int rng(int lim)
- {
- uniform_int_distribution<int> uid(0, lim - 1);
- return uid(rang);
- }
- int mpow(int base, int exp);
- void ipgraph(int n, int m);
- void dfs(int u, int par);
- const int mod = 1000000007;
- const int N = 3e5, M = N;
- //=======================
- const int di4[] = {-1, 0, 1, 0};
- const int dj4[] = { 0, 1, 0, -1};
- const int di8[] = {-1, 0, 1, 0, -1, 1,-1,1};
- const int dj8[] = { 0, 1, 0, -1, -1, 1,1,-1};
- vi g[N];
- int a[N];
- void solve()
- {
- int i, j, n, m;
- }
- int main()
- {
- ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
- srand(chrono::high_resolution_clock::now().time_since_epoch().count());
- int t = 1;
- cin >> t;
- while (t--)
- {
- solve();
- }
- return 0;
- }
- int mpow(int base, int exp)
- {
- base %= mod;
- int result = 1;
- while (exp > 0)
- {
- if (exp & 1)
- result = ((ll)result * base) % mod;
- base = ((ll)base * base) % mod;
- exp >>= 1;
- }
- return result;
- }
- void ipgraph(int n, int m)
- {
- int i, u, v;
- while (m--)
- {
- cin >> u >> v;
- u--, v--;
- g[u].pb(v);
- g[v].pb(u);
- }
- }
- void dfs(int u, int par)
- {
- for (int v : g[u])
- {
- if (v == par)
- continue;
- dfs(v, u);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement