Advertisement
Guest User

Untitled

a guest
Feb 6th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.98 KB | None | 0 0
  1. // Siempre incluir la libreria testlib.h al principio
  2. #include "testlib.h"
  3. #include <bits/stdc++.h>
  4.  
  5. using namespace std;
  6.  
  7. const int MAXN = 100000;
  8. const int MAXM = 10000;
  9. const int MAXA = 1000000;
  10.  
  11. // argc = cantidad de argumentos
  12. // argv contiene un arreglo de cadenas con los argumentos enumerados a partir de 1
  13.  
  14. int main(int argc, char *argv[]) {
  15.   registerGen(argc, argv, 1); // Esta linea va siempre al principio
  16.  
  17.   int seed = atoi(argv[1]); // La semilla para el generador
  18.  
  19.   // Se genera el input
  20.   // Nota: usar el rand de testlib (no el de c/c++)
  21.   // rnd.next(L, R) genera un numero entre L y R inclusive y rnd.next(N) genera un numero entre 0 y N - 1
  22.   int n = rnd.next(1, MAXN);
  23.   int m = rnd.next(1, MAXM);
  24.   cout << n << " " << m << endl;
  25.   for (int i = 0; i < n; ++i) {
  26.     cout << rnd.next(1, MAXA);
  27.     if (i < n - 1) cout << " ";
  28.   }
  29.   cout << endl;
  30.   for (int i = 0; i < m; ++i) {
  31.     cout << rnd.next(1, MAXA) << endl;
  32.   }
  33.   cout << endl;
  34.   return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement