Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <stdio.h>
- #include <vector>
- #include <algorithm>
- #include <string>
- #include <cmath>
- #include <cstring>
- #include <queue>
- #include <stack>
- #include <deque>
- #include <set>
- #include <map>
- #include <time.h>
- #include <stdlib.h>
- using namespace std;
- #define mp make_pair
- #define pb push_back
- #define vi vector <int>
- #define rep(i,n) for(int i = 0; i < n; i++)
- #define read(a) rep(i, a.size()) fin >> a[i];
- #define write(a) rep(i, a.size()) fout << a[i] << ' '; fout << endl;
- #define fi first
- #define se second
- #define ll long long
- const int inf = 2000000000, mod = 1000000007;
- const double eps = 0.000001;
- int main()
- {
- ofstream fout ("input.txt");
- srand(time(NULL));
- int n = 25000, m = 100000;
- fout << n << ' ' << m << endl;
- map <pair<int, int>, bool> was;
- vector <int> dsu(n, 0);
- for (int i = n / 2 + 1; i < n; i++)
- dsu[i] = 1;
- for (int i = n - n / 4; i < n; i++)
- dsu[i] = 2;
- for (int i = 0; i < m; i++)
- {
- int x = rand() % n, y = rand() % n;
- if (dsu[x] != dsu[y] || x == y || was[make_pair(x, y)])
- {
- i--;
- continue;
- }
- was[make_pair(x, y)] = true;
- fout << x + 1 << ' ' << y + 1 << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement