// One card travels from 1 to n and from n to 1 #include #include using namespace std; int main(int argc, char* argv[]) { // Check if there are at least two arguments (including the program name). int n = atoi(argv[1]); int m = atoi(argv[2]); int k = 2 * atoi(argv[3]); int seed = atoi(argv[3]); // Create a random number generator engine std::mt19937 rng(seed); // Mersenne Twister engine std::uniform_int_distribution piers(1, n); std::uniform_int_distribution cards(1, m); int c = cards(rng); cout << n << " " << m << " " << k << endl; for (int i = 0; i < k / 2; ++i) { if (piers(rng) % 2 == 0) { cout << 1 << " " << c << endl; cout << n << " " << c << endl; } else { cout << n << " " << c << endl; cout << 1 << " " << c << endl; } } return 0; }