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