結果

問題 No.2278 Time Bomb Game 2
ユーザー RubikunRubikun
提出日時 2023-04-21 21:47:11
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,993 bytes
コンパイル時間 2,174 ms
コンパイル使用メモリ 196,316 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-24 07:56:30
合計ジャッジ時間 7,410 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=998244353,MAX=300005,INF=1<<30;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll N,K,T;cin>>N>>K>>T;
    string S;cin>>S;
    K--;
    int L=INF,R=INF;
    for(int i=K-(T&1);i>=0;i-=2){
        if(S[i]!=S[K]&&abs(i-K)<=T){
            L=i;
            break;
        }
    }
    for(int i=K+(T&1);i<N;i+=2){
        if(S[i]!=S[K]&&abs(i-K)<=T){
            R=i;
            break;
        }
    }
    if(L!=INF){
        bool f=true;
        for(int i=L+1;i<K;i++) f&=(S[i]==S[K]);
        if(f&&(K-L)<=T){
            if(K-L>=2||K-L==T){
                if(S[K]=='A') cout<<"Alice\n";
                else cout<<"Bob\n";
                return 0;
            }
            if(K+1<N&&S[K]==S[K+1]){
                if(S[K]=='A') cout<<"Alice\n";
                else cout<<"Bob\n";
                return 0;
            }
        }else{
            L=INF;
        }
    }
    if(R!=INF){
        bool f=true;
        for(int i=K+1;i<R;i++) f&=(S[i]==S[K]);
        if(f&&(R-K)<=T){
            if(R-K>=2||R-K==T){
                if(S[K]=='A') cout<<"Alice\n";
                else cout<<"Bob\n";
                return 0;
            }
            if(K&&S[K]==S[K-1]){
                if(S[K]=='A') cout<<"Alice\n";
                else cout<<"Bob\n";
                return 0;
            }
        }else{
            R=INF;
        }
    }
    
    if(L!=INF||R!=INF){
        assert(false);
    }else{
        if(S[K]=='B') cout<<"Alice\n";
        else cout<<"Bob\n";
        return 0;
    }
    
}
0