結果

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

テストケース

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

ソースコード

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;
    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;
            }
        }
        cout << ((flag^ans)? "Alice":"Bob") << endl;
    }
    else{
        if(t%2==0){
            cout << ((flag)? "Alice":"Bob") << endl;
        }
        else{
            vl mle(INF);
        }
    }
}   
0