1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll; #define int long long const int mod = 1e9 +7; const int N = 1e5 + 10; deque<array<int,8> >A,B; int EA,EB; signed main() { ios::sync_with_stdio(false); cin.tie(nullptr),cout.tie(nullptr); int n,m,k; cin>>n>>m>>k; for(int i = 1;i <= n; i++) { int h,a,b,c,d,e,w; cin>>h>>a>>b>>c>>d>>e>>w; A.push_back({h,a,b,c,d,e,w,0}); } for(int i = 1;i <= m; i++) { int h,a,b,c,d,e,w; cin>>h>>a>>b>>c>>d>>e>>w; B.push_back({h,a,b,c,d,e,w,0}); } int now = 0; int cnt = 0; bool pj = false; while(!A.empty()&&!B.empty()) { if(now==1)cnt++; if(now==0&&!A.empty()&&!B.empty()) { now ^= 1; auto ta = A.front(); A.pop_front(); auto tb = B.front(); B.pop_front(); int a_wl = max(0ll,ta[1]-tb[3]); int a_mf = max(0ll,ta[2]-tb[4]); int a_w = ta[6]; int maxx = max({a_wl,a_mf,a_w}); if(maxx==a_wl||maxx==a_mf) { ta[7]++; if(tb[0]-maxx>0) { tb[0] -= maxx; B.push_front(tb); } A.push_back(ta); } else{ if(ta[7]>=ta[5]) { ta[7] -= ta[5]; if(tb[0]-maxx>0) { tb[0] -= maxx; B.push_front(tb); } } else { maxx = max(a_wl,a_mf); ta[7]++; if(tb[0]-maxx>0) { tb[0] -= maxx; B.push_front(tb); } } A.push_back(ta); } } else if(now==1&&!A.empty()&&!B.empty()) { now ^= 1; auto ta = A.front(); A.pop_front(); auto tb = B.front(); B.pop_front(); int b_wl = max(0ll,tb[1]-ta[3]); int b_mf = max(0ll,tb[2]-ta[4]); int b_w = tb[6]; int maxx = max({b_wl,b_mf,b_w}); if(maxx==b_wl||maxx==b_mf) { tb[7]++; if(ta[0]-maxx>0) { ta[0] -= maxx; A.push_front(ta); } B.push_back(tb); } else{ if(tb[7]>=tb[5]) { tb[7] -= tb[5]; if(ta[0]-maxx>0) { ta[0] -= maxx; A.push_front(ta); } } else { maxx = max(b_wl,b_mf); tb[7]++; if(ta[0]-maxx>0) { ta[0] -= maxx; A.push_front(ta); } } B.push_back(tb); } } if(cnt>=k) { pj = true; break; } } if(pj||(A.empty()&&B.empty()))cout<<"Draw\n"; else if(A.empty()&&!B.empty())cout<<"Bob\n"; else if(!A.empty()&&B.empty())cout<<"Alice\n"; else cout<<"Draw\n"; return 0; }
|