結果

問題 No.2278 Time Bomb Game 2
ユーザー fumofumofunifumofumofuni
提出日時 2023-04-21 23:24:54
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,607 bytes
コンパイル時間 2,248 ms
コンパイル使用メモリ 195,544 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-24 09:23:25
合計ジャッジ時間 4,264 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 WA -
testcase_03 AC 2 ms
5,376 KB
testcase_04 WA -
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 4 ms
5,376 KB
testcase_08 AC 3 ms
5,376 KB
testcase_09 AC 5 ms
5,376 KB
testcase_10 AC 5 ms
5,376 KB
testcase_11 AC 6 ms
5,376 KB
testcase_12 AC 6 ms
5,376 KB
testcase_13 AC 5 ms
5,376 KB
testcase_14 AC 5 ms
5,376 KB
testcase_15 AC 5 ms
5,376 KB
testcase_16 AC 5 ms
5,376 KB
testcase_17 AC 5 ms
5,376 KB
testcase_18 AC 5 ms
5,376 KB
testcase_19 AC 6 ms
5,376 KB
testcase_20 AC 5 ms
5,376 KB
testcase_21 AC 5 ms
5,376 KB
testcase_22 AC 6 ms
5,376 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 5 ms
5,376 KB
testcase_38 AC 5 ms
5,376 KB
testcase_39 AC 5 ms
5,376 KB
testcase_40 AC 5 ms
5,376 KB
testcase_41 AC 6 ms
5,376 KB
testcase_42 AC 6 ms
5,376 KB
testcase_43 AC 5 ms
5,376 KB
testcase_44 AC 5 ms
5,376 KB
testcase_45 AC 5 ms
5,376 KB
testcase_46 AC 5 ms
5,376 KB
testcase_47 AC 5 ms
5,376 KB
testcase_48 AC 5 ms
5,376 KB
testcase_49 AC 5 ms
5,376 KB
testcase_50 WA -
testcase_51 AC 5 ms
5,376 KB
testcase_52 AC 5 ms
5,376 KB
testcase_53 AC 5 ms
5,376 KB
testcase_54 WA -
testcase_55 AC 5 ms
5,376 KB
testcase_56 WA -
testcase_57 WA -
testcase_58 AC 6 ms
5,376 KB
testcase_59 AC 6 ms
5,376 KB
testcase_60 AC 5 ms
5,376 KB
testcase_61 AC 5 ms
5,376 KB
testcase_62 AC 5 ms
5,376 KB
testcase_63 WA -
testcase_64 AC 5 ms
5,376 KB
testcase_65 AC 6 ms
5,376 KB
testcase_66 AC 6 ms
5,376 KB
testcase_67 AC 6 ms
5,376 KB
testcase_68 WA -
testcase_69 WA -
testcase_70 WA -
testcase_71 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
//#pragma GCC optimize("Ofast")

#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=(n)-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[9]={1,0,-1,0,1,1,-1,-1,0};
const ll dx[9]={0,1,0,-1,1,-1,1,-1,0};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

int main(){
    ll n,k,t;cin >> n >> k >> t;
    k--;
    string s;cin >> s;
    auto dfs=[](auto &self,string s,ll k,ll n,ll t) -> ll {
        bool flag=false;
        if(s[k]=='B'){
            flag=true;
            rep(i,n){
                if(s[i]=='B')s[i]='A';
                else s[i]='B';
            }
        }
        ll left=INF,right=-INF;
        for(ll j=k;j>=0;j--){
            if(s[j]=='A')chmin(left,j);
            else break;
        }
        for(ll j=k;j<n;j++){
            if(s[j]=='A')chmax(right,j);
            else break;
        }
        if(left!=right){
            ll ans=0;
            if(left!=0){
                ll p=t;
                if(p>k-left){
                    p-=(k-left);
                    if(p%2)ans=1;
                }
            }
            if(right!=n-1){
                ll p=t;
                if(p>right-k){
                    p-=right-k;
                    if(p%2)ans=1;
                }
            }
            return flag^ans;
        }
        else{
            if(t%2==0){
                return flag;
            }
            else{
                ll ans=0;
                if(k-1>=0){
                    ll f=self(self,s,k-1,n,t-1);
                    if(f==0)ans=1;
                }
                if(k+1<n){
                    ll f=self(self,s,k+1,n,t-1);
                    if(f==0)ans=1;
                }
                return ans^flag;
            }
        }
    };
    cout << (dfs(dfs,s,k,n,t)? "Alice":"Bob") << endl;
}   
0