結果
問題 | No.2278 Time Bomb Game 2 |
ユーザー | Jeroen Op de Beek |
提出日時 | 2023-04-21 22:34:42 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 2,044 bytes |
コンパイル時間 | 2,074 ms |
コンパイル使用メモリ | 201,076 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-06 17:06:42 |
合計ジャッジ時間 | 4,180 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,248 KB |
testcase_02 | AC | 2 ms
5,248 KB |
testcase_03 | AC | 2 ms
5,248 KB |
testcase_04 | AC | 2 ms
5,248 KB |
testcase_05 | AC | 2 ms
5,248 KB |
testcase_06 | AC | 3 ms
5,248 KB |
testcase_07 | AC | 5 ms
5,248 KB |
testcase_08 | AC | 4 ms
5,248 KB |
testcase_09 | AC | 6 ms
5,248 KB |
testcase_10 | AC | 6 ms
5,248 KB |
testcase_11 | AC | 6 ms
5,248 KB |
testcase_12 | AC | 6 ms
5,248 KB |
testcase_13 | AC | 6 ms
5,248 KB |
testcase_14 | AC | 6 ms
5,248 KB |
testcase_15 | AC | 7 ms
5,248 KB |
testcase_16 | AC | 6 ms
5,248 KB |
testcase_17 | AC | 6 ms
5,248 KB |
testcase_18 | AC | 6 ms
5,248 KB |
testcase_19 | AC | 6 ms
5,248 KB |
testcase_20 | AC | 6 ms
5,248 KB |
testcase_21 | AC | 6 ms
5,248 KB |
testcase_22 | AC | 7 ms
5,248 KB |
testcase_23 | AC | 6 ms
5,248 KB |
testcase_24 | AC | 7 ms
5,248 KB |
testcase_25 | AC | 6 ms
5,248 KB |
testcase_26 | AC | 7 ms
5,248 KB |
testcase_27 | AC | 6 ms
5,248 KB |
testcase_28 | AC | 6 ms
5,248 KB |
testcase_29 | AC | 7 ms
5,248 KB |
testcase_30 | AC | 7 ms
5,248 KB |
testcase_31 | AC | 6 ms
5,248 KB |
testcase_32 | AC | 7 ms
5,248 KB |
testcase_33 | AC | 7 ms
5,248 KB |
testcase_34 | AC | 7 ms
5,248 KB |
testcase_35 | AC | 7 ms
5,248 KB |
testcase_36 | AC | 6 ms
5,248 KB |
testcase_37 | AC | 6 ms
5,248 KB |
testcase_38 | AC | 6 ms
5,248 KB |
testcase_39 | AC | 6 ms
5,248 KB |
testcase_40 | AC | 6 ms
5,248 KB |
testcase_41 | AC | 7 ms
5,248 KB |
testcase_42 | AC | 6 ms
5,248 KB |
testcase_43 | AC | 6 ms
5,248 KB |
testcase_44 | AC | 7 ms
5,248 KB |
testcase_45 | AC | 6 ms
5,248 KB |
testcase_46 | AC | 6 ms
5,248 KB |
testcase_47 | AC | 6 ms
5,248 KB |
testcase_48 | AC | 6 ms
5,248 KB |
testcase_49 | AC | 6 ms
5,248 KB |
testcase_50 | AC | 7 ms
5,248 KB |
testcase_51 | AC | 6 ms
5,248 KB |
testcase_52 | AC | 7 ms
5,248 KB |
testcase_53 | AC | 6 ms
5,248 KB |
testcase_54 | AC | 6 ms
5,248 KB |
testcase_55 | AC | 6 ms
5,248 KB |
testcase_56 | AC | 6 ms
5,248 KB |
testcase_57 | AC | 6 ms
5,248 KB |
testcase_58 | AC | 7 ms
5,248 KB |
testcase_59 | AC | 6 ms
5,248 KB |
testcase_60 | AC | 6 ms
5,248 KB |
testcase_61 | AC | 6 ms
5,248 KB |
testcase_62 | AC | 6 ms
5,248 KB |
testcase_63 | AC | 6 ms
5,248 KB |
testcase_64 | AC | 6 ms
5,248 KB |
testcase_65 | AC | 6 ms
5,248 KB |
testcase_66 | AC | 7 ms
5,248 KB |
testcase_67 | AC | 6 ms
5,248 KB |
testcase_68 | AC | 7 ms
5,248 KB |
testcase_69 | AC | 6 ms
5,248 KB |
testcase_70 | AC | 6 ms
5,248 KB |
testcase_71 | WA | - |
ソースコード
#include "bits/stdc++.h" using namespace std; #define all(x) begin(x),end(x) template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; } template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::value_type>::type> ostream& operator<<(ostream &os, const T_container &v) { string sep; for (const T &x : v) os << sep << x, sep = " "; return os; } #define debug(a) cerr << "(" << #a << ": " << a << ")\n"; typedef long long ll; typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int,int> pi; const int mxN = 1e5+1, oo = 1e9; /* starting, I can't reach a thing of the other colour in time loss. otherwise assume you can reach the other colour. if my thing is 1 big: Have to choose a side and recursively play it. If again it is 1 big. If I win on parity, I won If I lose on parity, other player can always play back, so this is just parity Otherwise, my run of cells is >1, can waste moves mod 2. If I can reach the other side with my parity I won. If can't reach other side or parities both bad, other player can force me back, so I lose */ bool solve(string s, int k, int t, bool first=1) { if(t==0) return false; int n = s.size(); if( (k==0 or s[k]!=s[k-1]) and (k==n-1 or s[k]!=s[k+1])) { if(!first) { if(t%2==1) return true; return false; } bool won=0; if(k) won|=!solve(s,k-1,t-1,0); if(k!=n-1) won|=!solve(s,k+1,t-1,0); } // can walk multiple int i=k, j =k; while(i>0 and s[i-1]==s[k]) i--; while(j<n-1 and s[j+1]==s[k]) ++j; bool won=0; auto dist = [&](int d) { if(d<=t and (t-d)%2==0) won=1; }; if(i!=0) dist(k-i+1); if(j!=n-1) dist(j-k+1); return won; } int main() { int n,k,t; cin >> n >> k >> t; string s; cin >> s; --k; auto res = solve(s,k,t); bool awon = res ^ (s[k]=='B'); cout << (awon?"Alice\n":"Bob\n"); }