Advertisement
999ms

Untitled

Apr 13th, 2019
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. bool dp[1001001][2];
  5.  
  6. int main() {
  7.   int n,k;
  8.   cin>>n>>k;
  9.   n++;
  10.   memset(dp, false, sizeof dp);
  11.   vector<int> a(k,0);
  12.   for(int i=0;i<k;i++){
  13.     cin>>a[i];
  14.   }
  15.   int l,r;
  16.   cin>>l>>r;
  17.   for(int i=n-1;i>=0;i--){
  18.     for(int st : a){
  19.       if(i + st < n){
  20.         dp[i][0] |= (dp[i + st][1]==false);
  21.       }
  22.     }
  23.     for(int st = l; st <= r; st++){
  24.       if(i + st < n){
  25.         dp[i][1] |= (dp[i + st][0]==false);
  26.       }
  27.     }
  28.   }
  29.   if(dp[0][0]){
  30.     cout<<"First";
  31.   } else {
  32.     cout<<"Second";
  33.   }
  34.   return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement