結果
問題 | No.1506 Unbalanced Pocky Game |
ユーザー | Mi |
提出日時 | 2021-05-14 22:30:31 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 63 ms / 2,000 ms |
コード長 | 3,281 bytes |
コンパイル時間 | 4,873 ms |
コンパイル使用メモリ | 264,128 KB |
実行使用メモリ | 40,060 KB |
最終ジャッジ日時 | 2024-10-02 02:12:19 |
合計ジャッジ時間 | 7,605 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 | 5 ms
5,248 KB |
testcase_04 | AC | 34 ms
25,088 KB |
testcase_05 | AC | 44 ms
28,800 KB |
testcase_06 | AC | 24 ms
18,560 KB |
testcase_07 | AC | 17 ms
14,080 KB |
testcase_08 | AC | 24 ms
19,456 KB |
testcase_09 | AC | 40 ms
29,952 KB |
testcase_10 | AC | 42 ms
30,464 KB |
testcase_11 | AC | 18 ms
14,720 KB |
testcase_12 | AC | 16 ms
13,312 KB |
testcase_13 | AC | 9 ms
8,448 KB |
testcase_14 | AC | 19 ms
14,336 KB |
testcase_15 | AC | 16 ms
12,416 KB |
testcase_16 | AC | 42 ms
29,480 KB |
testcase_17 | AC | 20 ms
15,744 KB |
testcase_18 | AC | 13 ms
11,008 KB |
testcase_19 | AC | 12 ms
9,728 KB |
testcase_20 | AC | 40 ms
30,208 KB |
testcase_21 | AC | 17 ms
13,440 KB |
testcase_22 | AC | 28 ms
20,736 KB |
testcase_23 | AC | 2 ms
5,248 KB |
testcase_24 | AC | 2 ms
5,248 KB |
testcase_25 | AC | 53 ms
40,060 KB |
testcase_26 | AC | 62 ms
39,296 KB |
testcase_27 | AC | 63 ms
39,808 KB |
testcase_28 | AC | 60 ms
38,400 KB |
testcase_29 | AC | 61 ms
38,680 KB |
testcase_30 | AC | 63 ms
39,888 KB |
testcase_31 | AC | 63 ms
39,928 KB |
testcase_32 | AC | 62 ms
39,372 KB |
testcase_33 | AC | 62 ms
39,120 KB |
testcase_34 | AC | 61 ms
38,272 KB |
testcase_35 | AC | 61 ms
38,344 KB |
testcase_36 | AC | 2 ms
5,248 KB |
testcase_37 | AC | 2 ms
5,248 KB |
testcase_38 | AC | 2 ms
5,248 KB |
testcase_39 | AC | 2 ms
5,248 KB |
testcase_40 | AC | 2 ms
5,248 KB |
testcase_41 | AC | 2 ms
5,248 KB |
testcase_42 | AC | 2 ms
5,248 KB |
testcase_43 | AC | 2 ms
5,248 KB |
testcase_44 | AC | 2 ms
5,248 KB |
testcase_45 | AC | 2 ms
5,248 KB |
testcase_46 | AC | 23 ms
15,744 KB |
testcase_47 | AC | 9 ms
7,552 KB |
testcase_48 | AC | 12 ms
8,704 KB |
testcase_49 | AC | 28 ms
18,048 KB |
testcase_50 | AC | 24 ms
16,128 KB |
testcase_51 | AC | 26 ms
17,664 KB |
testcase_52 | AC | 21 ms
14,336 KB |
testcase_53 | AC | 30 ms
20,224 KB |
testcase_54 | AC | 13 ms
9,600 KB |
testcase_55 | AC | 9 ms
7,552 KB |
testcase_56 | AC | 9 ms
7,552 KB |
testcase_57 | AC | 23 ms
16,000 KB |
testcase_58 | AC | 9 ms
7,424 KB |
testcase_59 | AC | 6 ms
6,820 KB |
testcase_60 | AC | 15 ms
10,752 KB |
testcase_61 | AC | 22 ms
15,488 KB |
testcase_62 | AC | 19 ms
13,056 KB |
testcase_63 | AC | 14 ms
10,368 KB |
testcase_64 | AC | 26 ms
17,536 KB |
testcase_65 | AC | 15 ms
11,136 KB |
ソースコード
#include<bits/stdc++.h> #include<atcoder/all> using namespace std; using namespace atcoder; typedef long long ll; typedef long double ld; typedef pair<ll,ll> P; typedef pair<int,int> Pi; #define rep(i,n) for(ll i=0;i<n;i++) #define FOR(i,a,b) for(ll i=a;i<b;i++) #define rrep(i,n) for(ll i=n-1;i>=0;i--) #define rFOR(i,a,b) for(ll i=a-1;i>=b;i--) #define all(x) (x).begin(),(x).end() #define fi first #define se second #define endl "\n" istream &operator>>(istream &is, modint &a) { long long v; is >> v; a = v; return is; } ostream &operator<<(ostream &os, const modint &a) { return os << a.val(); } istream &operator>>(istream &is, modint998244353 &a) { long long v; is >> v; a = v; return is; } ostream &operator<<(ostream &os, const modint998244353 &a) { return os << a.val(); } istream &operator>>(istream &is, modint1000000007 &a) { long long v; is >> v; a = v; return is; } ostream &operator<<(ostream &os, const modint1000000007 &a) { return os << a.val(); } template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;} template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;} template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";} template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";} template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;} template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;} template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;} template<typename T> ostream& operator<<(ostream& s,const multiset<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;} template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;} template<class T> vector<T> make_vec(size_t n, T a) { return vector<T>(n, a); } template<class... Ts> auto make_vec(size_t n, Ts... ts) { return vector<decltype(make_vec(ts...))>(n, make_vec(ts...)); } const ll mod=1'000'000'007; const ll inf=1'000'000'000'000'000'00; const int INF=1'000'000'000; const double EPS=1e-10; const double PI=acos(-1); int main(){ cin.tie(0);ios::sync_with_stdio(false); int n; cin>>n; vector<int> a(n); rep(i,n){ cin>>a[i]; chmin(a[i],3); } auto dp=make_vec(n,4,-1); auto dfs=[&](auto &&dfs,int i,int j)->int{ if(dp[i][j]!=-1) return dp[i][j]; if(i==0 && j==0) return dp[i][j]=0; if(j==0){ return dp[i][j]=dfs(dfs,i-1,a[i-1]); } int ret=0; rep(nj,j){ ret|=!dfs(dfs,i,nj); } if(ret) dp[i][j]=1; else dp[i][j]=0; return dp[i][j]; }; int ans=dfs(dfs,n-1,a[n-1]); if(ans) cout<<"Alice"<<endl; else cout<<"Bob"<<endl; }