Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- char dp[1001001][2];
- int a[10];
- int main() {
- int n,k;
- scanf("%d %d", &n, &k);
- n++;
- for(int i=0;i<=n;i++){
- for(int j=0;j<2;j++){
- dp[i][j] = 0;
- }
- }
- for(int i=0;i<k;i++){
- scanf("%d", &a[i]);
- }
- int l,r;
- scanf("%d %d", &l, &r);
- for(int i=n-1;i>=0;i--){
- for(int j=0;j<k;j++){
- int st = a[j];
- if(i + st < n){
- dp[i][0] |= (dp[i + st][1]==0);
- }
- }
- for(int st = l; st <= r; st++){
- if(i + st < n){
- dp[i][1] |= (dp[i + st][0]==0);
- }
- }
- }
- if(dp[0][0]){
- printf("First\n");
- } else {
- printf("Second\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement