Advertisement
Emiliatan

a329

May 28th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. /* a329             */
  2. /* AC (0.5s, 512KB) */
  3. #include <cstdio>
  4.  
  5. using namespace std;
  6.  
  7. const int MAXN = 100001, mod = 1234567;
  8. int N, M, x, sol[MAXN] = {0, 1};
  9.  
  10. int main()
  11. {
  12.     scanf("%d", &N);
  13.     for(int i = 1; i <= N && scanf("%d", &M); ++i)
  14.     {
  15.         for(int j = 1; j <= M && scanf("%d", &x); ++j)
  16.         {
  17.             sol[x] += sol[i];
  18.             sol[x] %= mod;
  19.         }
  20.     }
  21.     printf("%d\n", sol[N]);
  22.  
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement