結果
問題 | No.973 余興 |
ユーザー | 👑 kmjp |
提出日時 | 2020-01-18 01:52:17 |
言語 | C++14 (gcc 13.2.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,578 bytes |
コンパイル時間 | 1,620 ms |
コンパイル使用メモリ | 166,796 KB |
実行使用メモリ | 394,104 KB |
最終ジャッジ日時 | 2023-09-08 12:16:58 |
合計ジャッジ時間 | 64,960 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2,192 ms
352,692 KB |
testcase_01 | AC | 2,166 ms
353,136 KB |
testcase_02 | AC | 2,158 ms
353,152 KB |
testcase_03 | WA | - |
testcase_04 | AC | 2,165 ms
353,212 KB |
testcase_05 | WA | - |
testcase_06 | AC | 2,150 ms
353,324 KB |
testcase_07 | WA | - |
testcase_08 | AC | 2,162 ms
352,636 KB |
testcase_09 | AC | 2,127 ms
353,500 KB |
testcase_10 | WA | - |
testcase_11 | AC | 517 ms
237,132 KB |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | AC | 516 ms
237,020 KB |
testcase_15 | AC | 67 ms
92,300 KB |
testcase_16 | AC | 70 ms
92,368 KB |
testcase_17 | WA | - |
testcase_18 | AC | 54 ms
81,968 KB |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | AC | 67 ms
92,372 KB |
testcase_22 | AC | 67 ms
92,320 KB |
testcase_23 | AC | 54 ms
81,952 KB |
testcase_24 | AC | 53 ms
81,956 KB |
testcase_25 | AC | 27 ms
57,244 KB |
testcase_26 | AC | 42 ms
71,660 KB |
testcase_27 | WA | - |
testcase_28 | AC | 55 ms
81,952 KB |
testcase_29 | AC | 52 ms
82,184 KB |
testcase_30 | AC | 1,536 ms
366,604 KB |
testcase_31 | AC | 1,547 ms
366,436 KB |
testcase_32 | AC | 1,582 ms
366,372 KB |
testcase_33 | AC | 1,583 ms
366,320 KB |
testcase_34 | WA | - |
testcase_35 | AC | 1,561 ms
366,472 KB |
testcase_36 | AC | 1,567 ms
362,468 KB |
testcase_37 | AC | 1,551 ms
362,400 KB |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | AC | 3 ms
7,640 KB |
testcase_41 | AC | 2 ms
7,456 KB |
testcase_42 | AC | 2 ms
7,452 KB |
testcase_43 | WA | - |
testcase_44 | WA | - |
testcase_45 | AC | 5 ms
18,180 KB |
testcase_46 | AC | 1,950 ms
359,236 KB |
testcase_47 | WA | - |
testcase_48 | WA | - |
testcase_49 | AC | 1,616 ms
350,764 KB |
testcase_50 | AC | 1,651 ms
358,464 KB |
testcase_51 | WA | - |
testcase_52 | WA | - |
testcase_53 | WA | - |
testcase_54 | AC | 1,661 ms
372,072 KB |
testcase_55 | AC | 1,646 ms
372,068 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x,to) for(x=0;x<(to);x++) #define FORR(x,arr) for(auto& x:arr) #define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++) #define ALL(a) (a.begin()),(a.end()) #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) //------------------------------------------------------- template<class V, int ME> class BIT { public: V bit[1<<ME]; V operator()(int e) {if(e<0) return 0;V s=0;e++;while(e) s+=bit[e-1],e-=e&-e; return s;} void add(int e,V v) { e++; while(e<=1<<ME) bit[e-1]+=v,e+=e&-e;} }; BIT<int,13> Rm[5050],Lm[5050]; int N; ll X,A[5050]; int memo[5050][5050]; int R[5050]; int L[5050]; void solve() { int i,j,k,l,r,x,y; string s; cin>>N>>X; FOR(i,N) cin>>A[i]; FOR(i,N+1) { L[i]=R[i]=i; ll sum=0; for(j=i;j<N;j++) { sum+=A[j]; if(sum<=X) R[i]=j+1; } sum=0; for(j=i;j>=1;j--) { sum+=A[j-1]; if(sum<=X) L[i]=j-1; } Lm[i].add(i+1,1); Rm[i+1].add(i,1); } for(int len=2;len<=N;len++) { for(x=0;x+len<=N;x++) { y=Rm[x+len](R[x]); y+=Lm[x](x+len)-Lm[x](L[x+len]); memo[x][x+len]=y>0; if(y==0) { Lm[x].add(x+len,1); Rm[x+len].add(x,1); } } } if(memo[0][N]) cout<<"A"<<endl; else cout<<"B"<<endl; } int main(int argc,char** argv){ string s;int i; if(argc==1) ios::sync_with_stdio(false), cin.tie(0); FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin); cout.tie(0); solve(); return 0; }