結果
| 問題 |
No.2278 Time Bomb Game 2
|
| コンテスト | |
| ユーザー |
Rubikun
|
| 提出日時 | 2023-04-21 21:43:39 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,925 bytes |
| コンパイル時間 | 1,954 ms |
| コンパイル使用メモリ | 194,760 KB |
| 最終ジャッジ日時 | 2025-02-12 11:19:24 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 43 WA * 6 RE * 21 |
ソースコード
#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;
}
}
}
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;
}
}
}
if(L!=INF&&R!=INF){
assert(false);
}else{
if(S[K]=='B') cout<<"Alice\n";
else cout<<"Bob\n";
return 0;
}
}
Rubikun