結果
問題 | No.2278 Time Bomb Game 2 |
ユーザー |
|
提出日時 | 2023-04-21 21:45:59 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 518 bytes |
コンパイル時間 | 700 ms |
コンパイル使用メモリ | 67,216 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-06 17:00:52 |
合計ジャッジ時間 | 2,740 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 69 WA * 1 |
ソースコード
#include<iostream> using namespace std; int N,K,T; string C; bool win() { int l=K,r=K; while(l>=0&&C[l]=='A')l--; while(r<N&&C[r]=='A')r++; if(l>=0&&(K-l)%2==T%2&&K-l<=T)return true; if(r<N&&(r-K)%2==T%2&&r-K<=T)return true; return false; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cin>>N>>K>>T>>C; K--; if(C[K]=='A') { if(win())cout<<"Alice"<<endl; else cout<<"Bob"<<endl; } else { for(char&c:C)c=c=='A'?'B':'A'; if(!win())cout<<"Alice"<<endl; else cout<<"Bob"<<endl; } }