Advertisement
999ms

Untitled

Apr 13th, 2019
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.66 KB | None | 0 0
  1. #include <stdio.h>
  2. char dp[1001001][2];
  3. int a[10];
  4. int main() {
  5.   int n,k;
  6.   scanf("%d %d", &n, &k);
  7.   n++;
  8.   for(int i=0;i<=n;i++){
  9.     for(int j=0;j<2;j++){
  10.       dp[i][j] = 0;
  11.     }
  12.   }
  13.   for(int i=0;i<k;i++){
  14.     scanf("%d", &a[i]);
  15.   }
  16.   int l,r;
  17.   scanf("%d %d", &l, &r);
  18.   for(int i=n-1;i>=0;i--){
  19.     for(int j=0;j<k;j++){
  20.       int st = a[j];
  21.       if(i + st < n){
  22.         dp[i][0] |= (dp[i + st][1]==0);
  23.       }
  24.     }
  25.     for(int st = l; st <= r; st++){
  26.       if(i + st < n){
  27.         dp[i][1] |= (dp[i + st][0]==0);
  28.       }
  29.     }
  30.   }
  31.   if(dp[0][0]){
  32.     printf("First\n");
  33.   } else {
  34.     printf("Second\n");
  35.   }
  36.   return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement