Submission #3948285


Source Code Expand

Copy
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
            ∧_∧  
      ∧_∧  (´<_` )  Welcome to My Coding Space!
     ( ´_ゝ`) /  ⌒i     
    /   \     | |     
    /   / ̄ ̄ ̄ ̄/  |  
  __(__ニつ/     _/ .| .|____  
     \/____/ (u ⊃  
---------------------------------------------------------------------------------------------------*/











int N, K, A[101], dp[101010];
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N >> K;
    rep(i, 0, N) cin >> A[i];

    rep(k, 0, K + 1) {
        int lose = 0, cnt = 0;
        rep(i, 0, N) if (0 <= k - A[i]) {
            cnt++;
            if(!dp[k - A[i]]) lose++;
        }
        if (cnt == 0) dp[k] = 0;
        else if (0 < lose) dp[k] = 1;
        else dp[k] = 0;
    }

    if (dp[K]) printf("First\n");
    else printf("Second\n");
}

Submission Info

Submission Time
Task K - Stones
User hamayanhamayan
Language C++14 (GCC 5.4.1)
Score 100
Code Size 1811 Byte
Status AC
Exec Time 13 ms
Memory 640 KB

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 28
Set Name Test Cases
All 0_00, 0_01, 0_02, 0_03, 0_04, 0_05, 1_00, 1_01, 1_02, 1_03, 1_04, 1_05, 1_06, 1_07, 1_08, 1_09, 1_10, 1_11, 1_12, 1_13, 1_14, 1_15, 1_16, 1_17, 1_18, 1_19, 1_20, 1_21
Case Name Status Exec Time Memory
0_00 AC 1 ms 256 KB
0_01 AC 1 ms 256 KB
0_02 AC 1 ms 256 KB
0_03 AC 1 ms 256 KB
0_04 AC 1 ms 256 KB
0_05 AC 2 ms 640 KB
1_00 AC 1 ms 256 KB
1_01 AC 2 ms 640 KB
1_02 AC 2 ms 640 KB
1_03 AC 13 ms 640 KB
1_04 AC 13 ms 640 KB
1_05 AC 13 ms 640 KB
1_06 AC 12 ms 640 KB
1_07 AC 12 ms 640 KB
1_08 AC 12 ms 640 KB
1_09 AC 12 ms 640 KB
1_10 AC 12 ms 640 KB
1_11 AC 12 ms 640 KB
1_12 AC 12 ms 640 KB
1_13 AC 13 ms 640 KB
1_14 AC 12 ms 640 KB
1_15 AC 13 ms 640 KB
1_16 AC 12 ms 640 KB
1_17 AC 13 ms 640 KB
1_18 AC 13 ms 640 KB
1_19 AC 13 ms 640 KB
1_20 AC 12 ms 640 KB
1_21 AC 13 ms 640 KB