Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define fileName string ("")
- #define TEST_GENERATOR
- #define INP (fileName + ".inp").c_str ()
- #define OUT (fileName + ".out").c_str ()
- #define ERR (fileName + ".err").c_str ()
- /* ---------------------------------------------------------------------------------------- */
- #include <algorithm>
- #include <iostream>
- #include <numeric>
- #include <sstream>
- #include <cstdlib>
- #include <climits>
- #include <cstring>
- #include <iomanip>
- #include <limits>
- #include <bitset>
- #include <locale>
- #include <cstdio>
- #include <vector>
- #include <cmath>
- #include <stack>
- #include <queue>
- #include <deque>
- #include <ctime>
- #include <list>
- #include <map>
- #include <set>
- using namespace std;
- #define fi first
- #define se second
- #define mp make_pair
- #define pb push_back
- #define pp pop_back
- #define rp(i, n) for (int i = 0; i < (n); ++i)
- #define rd(i, n) for (int i = (n); i--;)
- #define rs(i, x) rp (i, sz (x))
- #define rr(i, x) rd (i, sz (x))
- #define fr(i, a, b) for (int i = (a); i <= (b); ++i)
- #define fd(i, a, b) for (int i = (a); i >= (b); --i)
- #define fe(i, x) for (__typeof ((x).begin ()) i = (x).begin (); i != (x).end (); ++i)
- #define fer(i, x) for (__typeof ((x).rbegin ()) i = (x).rbegin (); i != (x).rend (); ++i)
- #define cd(x) while ((x)--)
- #define srt(v) sort (all (v))
- #define srt(v) sort (all (v))
- #define srtr(v) sort (allr (v))
- #define mn(x, y) x = min (x, y)
- #define mx(x, y) x = max (x, y)
- #define all(x) (x).begin (), (x).end ()
- #define allr(x) (x).rbegin (), (x).rend ()
- #define sz(x) ((int) (x).size ())
- #define cl(x) memset (x, 0, sizeof (x))
- #define sqr(x) ((x) * (x))
- const double pi = acos(-1.0);
- typedef unsigned long long llu;
- typedef long long ll;
- typedef pair <int, int> ii;
- typedef pair <int, ii> iii;
- typedef vector <string> vs;
- typedef vector <ii> vii;
- typedef vector <int> vi;
- typedef vector <vi> vvi;
- typedef vector <vii> vvii;
- typedef vector <bool> vb;
- typedef vector <vb> vvb;
- struct disjoint_set
- {
- vi pset; int _sz;
- inline int size () {return _sz;}
- inline void init (const int &n) {pset.resize (n); rp (i, n) pset [i] = i; _sz = n;}
- disjoint_set () {};
- disjoint_set (const int &n) {init (n);}
- int find (const int &x) {return (x == pset [x] ? x : pset [x] = find (pset [x]));}
- inline bool same (const int &x, const int &y) {return (find (x) == find (y));}
- inline bool join (const int &x, const int &y) {int xx = find (x), yy = find (y); if (xx == yy) return false; --_sz; pset [xx] = yy; return true;}
- };
- template <class T> inline string ns (const T &number) {stringstream ss; ss << number; return ss.str ();}
- template <class T> inline T sn (const string &s) {stringstream ss (s); T result; return ss >> result ? result : 0;}
- template <class T> inline T pow2 (const int &x) {return (T) 1 << x;}
- template <class T> inline int log2 (T x) {int res = 0; while (x >>= 1) ++res; return res;}
- template <class T> inline T rand () {int cnt = sizeof (T) * 8 / 15 + 1; T res = 0; cd (cnt) res = (res << 15) | rand (); return res;}
- template <class T> inline T rand (T x, T y) {if (x > y) swap (x, y); T diff = y - x + 1, tmp = rand <T> () % diff; if (tmp >= 0) return tmp + x; return tmp + diff + x;}
- template <class T> inline T _abs (const T &x) {return (x >= 0 ? x : -x);}
- template <class T> inline T gcd (T x, T y) {x = _abs (x); y = _abs (y); if (!x || !y) return 0; T tmp; while (y) {tmp = y; y = x % y; x = tmp;} return x;}
- template <class T> inline T lcm (T x, T y) {x = _abs (x), y = _abs (y); return (x && y ? x / gcd (x, y) * y : 0);}
- template <class T> struct BIT
- {
- vector <T> tree; int _sz; inline int size () {return _sz;}
- inline void init (const int &n) {_sz = n; tree.assign (n + 1, 0);} BIT () {} BIT (const int &n) {init (n);}
- inline void add (int i, const T &v) {for (; i <= _sz; i += i & -i) tree [i] += v;}
- inline T sum (int i) {T s = 0; for (; i; i -= i & -i) s += tree [i]; return s;}
- inline T sum (const int &i, const int &j) {return sum (j) - sum (i - 1);}
- };
- #define mod
- /* ---------------------------------------------------------------------------------------- */
- bool mark [10000];
- int main ()
- {
- srand (time (NULL));
- #ifndef ONLINE_JUDGE
- #ifdef TEST_GENERATOR
- freopen (INP, "w", stdout);
- #else
- freopen (INP, "r", stdin);
- freopen (OUT, "w", stdout);
- //freopen (ERR, "w", stderr);
- #endif
- #endif
- int t = rand (1, 20);
- printf ("%d\n", t);
- cd (t)
- {
- int n = rand (1, 500); printf ("%d", n);
- cl (mark);
- cd (n)
- {
- int tmp;
- do tmp = rand (1, 9999); while (mark [tmp]);
- mark [tmp] = true;
- cout << " " << setfill ('0') << setw (4) << tmp;
- }
- putchar ('\n');
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment