Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "testlib.h"
- #include <iostream>
- #include <vector>
- #include <algorithm>
- #include <string>
- #include <cstring>
- #include <queue>
- #include <math.h>
- #include <map>
- #include <set>
- #include <stdio.h>
- #include <complex>
- #define ll long long
- #define ff first
- #define ss second
- #define pii pair<int, int>
- using namespace std;
- /*
- generate ticket of this kind:
- 1 2 3 4
- 5 6 7 8
- 9 10 11 12
- */
- int main(int argc, char *argv[])
- {
- registerGen(argc, argv, 1);
- if (argc < 5)
- {
- printf("Usage: gen_ordered [n] [m] [q] [k]\n");
- return 0;
- }
- int n = atoi(argv[1]);
- int m = atoi(argv[2]);
- int q = atoi(argv[3]);
- int k = atoi(argv[4]);
- q = min(q, n * m);
- printf("%d %d %d %d\n", n, m, q, k);
- for (int i = 0; i < n; ++i)
- {
- for (int j = 0; j < m; ++j)
- {
- if (j != 0)
- putchar(' ');
- printf("%d", min(k, i * m + j + 1));
- }
- putchar('\n');
- }
- int cnt = 0;
- for (int j = m; j > 0; --j)
- for (int i = n; i > 0; --i)
- {
- if (cnt == q)
- return 0;
- printf("%d %d\n", i, j), cnt++;
- }
- return 0;
- }
- /*
- 211701YWCWR
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement