Example #1
0
  static void read_automata_defined() {
    for (int i = 0; i < N; i++) {
      int sj = fio.nextInt();

      for (int j = 0; j < M; j++) {
        int h = fio.nextInt();
        for (int k = 0; k < h; k++) states[fio.nextInt()].addEdge(j, sj);
      }
      fio.nextLine();
    }
  }
Example #2
0
 static void read_automata_generated() {
   int B = fio.nextInt();
   int C = fio.nextInt();
   int T = fio.nextInt();
   int U = fio.nextInt();
   int V = fio.nextInt();
   int W = fio.nextInt();
   int floor = N / B;
   for (int sj = 0; sj < N; sj++)
     for (int h = 0; h < M; h++)
       for (int k = 1; k <= T + ((U * sj + V * h) % W); k++) {
         if (sj < floor) states[1 + sj + ((B * sj * k + C * h) % (N - floor - 1))].addEdge(h, sj);
         else states[floor + ((B * sj * k + C * h) % (N - floor))].addEdge(h, sj);
       }
 }
Example #3
0
  static void read_data() {
    shortest.length = Integer.MAX_VALUE;
    longest.length = Integer.MIN_VALUE;

    N = fio.nextInt();
    M = fio.nextInt();

    states = new Node[N];

    FIRST = states[0] = new Node(0);

    for (int i = 1; i < N; i++) states[i] = new Node(i);

    Q = fio.nextInt() == 1;

    fio.nextLine();

    if (Q) read_automata_defined();
    else read_automata_generated();
    read_terminals();
  }
Example #4
0
  static void read_terminals() {
    int n = fio.nextInt();
    int i = -1;

    while (++i < n) states[fio.nextInt()].isTerminal = true;
  }