123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- #include "testlib.h"
- #include <iostream>
- #include <sstream>
- #include <fstream>
- #include <iomanip>
- #include <string>
- #include <cstdlib>
- #include <cstdio>
- #include <cstring>
- #include <cmath>
- #include <ctime>
- #include <climits>
- #include <cassert>
- #include <vector>
- #include <queue>
- #include <stack>
- #include <deque>
- #include <set>
- #include <map>
- #include <bitset>
- #include <utility>
- #include <algorithm>
- #define forn(i, n) for (int i = 0; i < int(n); i++)
- using namespace std;
- int main(int argc, char* argv[])
- {
- registerGen(argc, argv);
- int n = atoi(argv[1]);
- int t = atoi(argv[2]);
- vector<int> p(n);
- forn(i, n)
- if (i > 0)
- p[i] = rnd.wnext(i, t);
- printf("%d\n", n);
- vector<int> perm(n);
- forn(i, n)
- perm[i] = i;
- shuffle(perm.begin() + 1, perm.end());
- vector<int> pp(n);
- for (int i = 1; i < n; i++)
- pp[perm[i]] = perm[p[i]];
- for (int i = 1; i < n; i++)
- {
- printf("%d", pp[i] + 1);
- if (i + 1 < n)
- printf(" ");
- }
- printf("\n");
- return 0;
- }
|