結果

問題 No.2278 Time Bomb Game 2
ユーザー Shreyan RayShreyan Ray
提出日時 2023-04-21 22:26:52
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,243 bytes
コンパイル時間 2,111 ms
コンパイル使用メモリ 200,968 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-06 17:05:34
合計ジャッジ時間 4,129 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 69 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define INF (int)1e18
#define f first
#define s second

mt19937_64 RNG(chrono::steady_clock::now().time_since_epoch().count());
bool g[2];

void Solve() 
{
    int n, k, t; cin >> n >> k >> t;
    k--;
    
    string s; cin >> s;
    
    int l = k, r = k;
    while (l >= 0 && s[l] == s[k]) l--;
    while (r < n && s[r] == s[k]) r++;
    
    if (l >= 0 && l >= k - t) g[l & 1] = true;
    if (r < n && r <= k + t) g[r & 1] = true;
    
    bool win = g[(t + k) & 1];
    //assert(r - l > 2);
    if (s[k] == 'A') {
        if (win) cout << "Alice\n";
        else cout << "Bob\n";
    }
    else {
        if (win) cout << "Bob\n";
        else cout << "Alice\n";
    }
}

int32_t main() 
{
    auto begin = std::chrono::high_resolution_clock::now();
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t = 1;
 //   cin >> t;
    for(int i = 1; i <= t; i++) 
    {
        //cout << "Case #" << i << ": ";
        Solve();
    }
    auto end = std::chrono::high_resolution_clock::now();
    auto elapsed = std::chrono::duration_cast<std::chrono::nanoseconds>(end - begin);
   // cerr << "Time measured: " << elapsed.count() * 1e-9 << " seconds.\n"; 
    return 0;
}
0