Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- bool dp[1001001][2];
- int main() {
- int n,k;
- cin>>n>>k;
- n++;
- memset(dp, false, sizeof dp);
- vector<int> a(k,0);
- for(int i=0;i<k;i++){
- cin>>a[i];
- }
- int l,r;
- cin>>l>>r;
- for(int i=n-1;i>=0;i--){
- for(int st : a){
- if(i + st < n){
- dp[i][0] |= (dp[i + st][1]==false);
- }
- }
- for(int st = l; st <= r; st++){
- if(i + st < n){
- dp[i][1] |= (dp[i + st][0]==false);
- }
- }
- }
- if(dp[0][0]){
- cout<<"First";
- } else {
- cout<<"Second";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement