Advertisement
999ms

Untitled

Apr 13th, 2019
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.64 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. bool dp[1001001][2];
  5.  
  6. int main() {
  7.   ios_base::sync_with_stdio(false);
  8.   cin.tie(nullptr);  
  9.   int n,k;
  10.   cin>>n>>k;
  11.   n++;
  12.   memset(dp, false, sizeof dp);
  13.   vector<int> a(k,0);
  14.   for(int i=0;i<k;i++){
  15.     cin>>a[i];
  16.   }
  17.   int l,r;
  18.   cin>>l>>r;
  19.   for(int i=n-1;i>=0;i--){
  20.     for(int st : a){
  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.     cout<<"First";
  33.   } else {
  34.     cout<<"Second";
  35.   }
  36.   return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement