結果

問題 No.1267 Stop and Coin Game
ユーザー ocvret_ocvret_
提出日時 2020-10-23 23:54:21
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 858 bytes
コンパイル時間 1,672 ms
コンパイル使用メモリ 170,652 KB
実行使用メモリ 7,548 KB
最終ジャッジ日時 2023-09-28 19:15:03
合計ジャッジ時間 6,106 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 2 ms
4,380 KB
testcase_10 WA -
testcase_11 AC 1 ms
4,380 KB
testcase_12 WA -
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 2 ms
4,384 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 TLE -
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>
//#include<atcoder/all>

using namespace std;
//using namespace atcoder;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007



int main(){
  
  int n;
  ll V;
  cin >> n >> V;
  vector<ll> a(n);
  rep(i,n)cin >> a[i];
  sort(ALL(a));
  {
    ll sum = 0;
    rep(i,n)sum += a[i];
    if(sum <= V){
      cout << "Draw\n";
      return 0;
    }
  }
  int res = 0;
  while(V >= a[0]){
    int pos = -1;
    rep(i,a.size()){
      if(V-a[i] < 0)pos = 0;
      else if(V-a[i] < a[0]){
        pos = i;
        break;
      }
    }
    V -= a[pos];
    for(int i = pos;i < a.size()-1;i++)swap(a[i],a[i+1]);
    a.pop_back();
    res = 1-res;
  }
  cout << (res ? "First\n" : "Second\n");
  



  return 0;
}
0