結果
問題 | No.973 余興 |
ユーザー | kzyKT |
提出日時 | 2020-01-17 21:54:36 |
言語 | C++11 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,837 bytes |
コンパイル時間 | 1,148 ms |
コンパイル使用メモリ | 144,508 KB |
実行使用メモリ | 199,556 KB |
最終ジャッジ日時 | 2023-09-08 02:41:16 |
合計ジャッジ時間 | 19,769 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 532 ms
199,212 KB |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | AC | 483 ms
199,332 KB |
testcase_04 | AC | 484 ms
199,448 KB |
testcase_05 | AC | 483 ms
199,556 KB |
testcase_06 | WA | - |
testcase_07 | AC | 488 ms
199,448 KB |
testcase_08 | AC | 485 ms
199,272 KB |
testcase_09 | AC | 492 ms
199,200 KB |
testcase_10 | WA | - |
testcase_11 | AC | 190 ms
199,340 KB |
testcase_12 | WA | - |
testcase_13 | AC | 184 ms
199,020 KB |
testcase_14 | AC | 185 ms
199,160 KB |
testcase_15 | WA | - |
testcase_16 | AC | 73 ms
198,824 KB |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | AC | 69 ms
198,812 KB |
testcase_20 | WA | - |
testcase_21 | AC | 72 ms
198,868 KB |
testcase_22 | AC | 74 ms
198,812 KB |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | AC | 65 ms
198,848 KB |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | AC | 67 ms
198,860 KB |
testcase_30 | AC | 411 ms
199,252 KB |
testcase_31 | AC | 422 ms
199,216 KB |
testcase_32 | AC | 413 ms
199,280 KB |
testcase_33 | AC | 406 ms
199,260 KB |
testcase_34 | WA | - |
testcase_35 | AC | 402 ms
199,256 KB |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | AC | 404 ms
199,212 KB |
testcase_40 | AC | 52 ms
198,780 KB |
testcase_41 | AC | 54 ms
199,012 KB |
testcase_42 | AC | 54 ms
198,712 KB |
testcase_43 | AC | 54 ms
198,868 KB |
testcase_44 | WA | - |
testcase_45 | AC | 52 ms
198,784 KB |
testcase_46 | AC | 403 ms
199,200 KB |
testcase_47 | AC | 405 ms
199,260 KB |
testcase_48 | WA | - |
testcase_49 | WA | - |
testcase_50 | WA | - |
testcase_51 | WA | - |
testcase_52 | AC | 419 ms
199,228 KB |
testcase_53 | WA | - |
testcase_54 | AC | 413 ms
199,272 KB |
testcase_55 | WA | - |
ソースコード
#include <bits/stdc++.h> using namespace std; #define F first #define S second #define R cin>> #define Z class #define ll long long #define ln cout<<'\n' #define in(a) insert(a) #define pb(a) push_back(a) #define pd(a) printf("%.10f\n",a) #define mem(a) memset(a,0,sizeof(a)) #define all(c) (c).begin(),(c).end() #define iter(c) __typeof((c).begin()) #define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--) #define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++) #define rep(i,n) REP(i,0,n) #define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++) template<Z A>void pr(A a){cout<<a;ln;} template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);} template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);} template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);} template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;} ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;} const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1}; typedef pair<ll,ll> P; int dp[2][5001][5001],m,a[5555]; int dfs(int l, int r, int t,int k,ll sum) { if(dp[t][l][r]!=-1) return dp[t][l][r]; if(l==r||sum>m) return t^1; int s=t^1; if(k==-1) { int z=dfs(l+1,r,t,0,sum+a[l]); if(z==t) s=z; z=dfs(l+1,r,t^1,-1,0); if(z==t) s=z; z=dfs(l,r-1,t,1,sum+a[r]); if(z==t) s=z; z=dfs(l,r-1,t^1,-1,0); if(z==t) s=z; } else if(k==0) { int z=dfs(l+1,r,t,0,sum+a[l]); if(z==t) s=z; z=dfs(l+1,r,t^1,-1,0); if(z==t) s=z; } else { int z=dfs(l,r-1,t,1,sum+a[r]); if(z==t) s=z; z=dfs(l,r-1,t^1,-1,0); if(z==t) s=z; } dp[t][l][r]=s; return s; } void Main() { ll n; cin >> n >> m; rep(i,n) cin >> a[i]; memset(dp,-1,sizeof(dp)); if(dfs(0,n-1,1,-1,0)) pr("A"); else pr("B"); } int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}