結果

問題 No.1267 Stop and Coin Game
ユーザー recososorecososo
提出日時 2020-10-23 23:10:59
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,386 bytes
コンパイル時間 1,535 ms
コンパイル使用メモリ 168,668 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-28 17:53:37
合計ジャッジ時間 5,412 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 70 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m; i >= n; --i)
#define ALL(v) (v).begin(),(v).end()
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; }
const ll INF=1LL<<60;
const int inf=(1<<30)-1;
const int mod=1e9+7;
int dx[8]={1,0,-1,0,-1,-1,1,1};
int dy[8]={0,1,0,-1,-1,1,-1,1};
ll n,v;
vector<ll> a(21);
bool f(int t=0,bool cur=true,int vol=v){
    bool fl;
    if(cur){
        fl=false;
        REP(i,n){
            if(t&(1<<i)) continue;
            if(vol-a[i]<0) continue;
            fl=(fl|f(t+(1<<i),false,vol-a[i]));
        }
    }
    else{
        fl=true;
        REP(i,n){
            if(t&(1<<i)) continue;
            if(vol-a[i]<0) continue;
            fl=(fl&f(t+(1<<i),true,vol-a[i]));
        }
    }
    return fl;
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> v;
    a.resize(n);
    ll sum=0;
    REP(i,n){
        cin >> a[i];
        sum+=a[i];
    }
    if(sum<=v){
        cout << "Draw" << endl;
        return 0;
    }
    cout << (f()?"First":"Second") << endl;
}
0