这里会显示出您选择的修订版和当前版本之间的差别。
两侧同时换到之前的修订记录 前一修订版 | |||
2020-2021:teams:wangzai_milk:20200810比赛记录 [2020/08/13 19:48] infinity37 [E - Game] |
2020-2021:teams:wangzai_milk:20200810比赛记录 [2020/08/14 16:27] (当前版本) wzx27 |
||
---|---|---|---|
行 14: | 行 14: | ||
===== 题解 ===== | ===== 题解 ===== | ||
+ | ==== D - Hearthstone Battleground ==== | ||
+ | |||
+ | 容易想到要贪心的用植物去破盾,所以优先用有亡语的随从生成植物去破盾,注意每次攻击前要清除对方的植物。 | ||
+ | |||
+ | <hidden code> <code cpp> | ||
+ | /* | ||
+ | #pragma GCC optimize(2) | ||
+ | #pragma GCC optimize(3,"Ofast","inline") | ||
+ | */ | ||
+ | #include<bits/stdc++.h> | ||
+ | #define ALL(x) (x).begin(),(x).end() | ||
+ | #define ll long long | ||
+ | #define db double | ||
+ | #define ull unsigned long long | ||
+ | #define pii_ pair<int,int> | ||
+ | #define mp_ make_pair | ||
+ | #define pb push_back | ||
+ | #define fi first | ||
+ | #define se second | ||
+ | #define rep(i,a,b) for(int i=(a);i<=(b);i++) | ||
+ | #define per(i,a,b) for(int i=(a);i>=(b);i--) | ||
+ | #define show1(a) cout<<#a<<" = "<<a<<endl | ||
+ | #define show2(a,b) cout<<#a<<" = "<<a<<"; "<<#b<<" = "<<b<<endl | ||
+ | using namespace std; | ||
+ | const ll INF = 1LL<<60; | ||
+ | const int inf = 1<<30; | ||
+ | const int maxn = 2e5+5; | ||
+ | inline void fastio() {ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);} | ||
+ | |||
+ | int a[5],b[5]; | ||
+ | void act1() | ||
+ | { | ||
+ | if(b[3]) b[3]--,b[0]++,a[3]++,a[1]--; | ||
+ | else if(b[4]) b[4]--,a[3]++,a[1]--; | ||
+ | else if(b[1]) b[1]--,b[3]++,a[3]++,a[1]--; | ||
+ | else if(b[2]) b[2]--,b[4]++,a[3]++,a[1]--; | ||
+ | } | ||
+ | void act2() | ||
+ | { | ||
+ | if(b[3]) b[3]--,b[0]++,a[2]--,a[4]++; | ||
+ | else if(b[4]) b[4]--,a[2]--,a[4]++; | ||
+ | else if(b[1]) b[1]--,b[3]++,a[2]--,a[4]++; | ||
+ | else if(b[2]) b[2]--,b[4]++,a[2]--,a[4]++; | ||
+ | } | ||
+ | void act4() | ||
+ | { | ||
+ | if(b[3]) b[3]--,b[0]++,a[4]--; | ||
+ | else if(b[4]) b[4]--,a[4]--; | ||
+ | else if(b[1]) b[1]--,b[3]++,a[4]--; | ||
+ | else if(b[2]) b[2]--,b[4]++,a[4]--; | ||
+ | } | ||
+ | void act3() | ||
+ | { | ||
+ | if(b[3]) b[3]--,a[0]++,b[0]++,a[3]--; | ||
+ | else if(b[4]) b[4]--,a[0]++,a[3]--; | ||
+ | else if(b[1]) b[1]--,b[3]++,a[0]++,a[3]--; | ||
+ | else if(b[2]) b[2]--,b[4]++,a[0]++,a[3]--; | ||
+ | } | ||
+ | void act0() | ||
+ | { | ||
+ | if(b[1]) b[1]--,b[3]++,a[0]--; | ||
+ | else if(b[2]) b[2]--,b[4]++,a[0]--; | ||
+ | } | ||
+ | bool win() | ||
+ | { | ||
+ | int aa = a[1] + a[2] + a[3] + a[4]; | ||
+ | int bb = b[1] + b[2] + b[3] + b[4]; | ||
+ | if(bb==0) { | ||
+ | if(aa>0 || a[0]>b[0]) return 1; | ||
+ | } | ||
+ | return 0; | ||
+ | } | ||
+ | int main() | ||
+ | { | ||
+ | fastio(); | ||
+ | int _; | ||
+ | for(cin>>_;_;_--){ | ||
+ | memset(a,0,sizeof(a)); | ||
+ | memset(b,0,sizeof(b)); | ||
+ | rep(i,1,4) cin>>a[i]; | ||
+ | rep(i,1,4) cin>>b[i]; | ||
+ | while(a[1]+a[2]+a[3]+a[4] && b[1]+b[2]+b[3]+b[4]){ | ||
+ | if(a[3]){ | ||
+ | b[0] = 0; | ||
+ | act3();act0(); | ||
+ | }else if(a[1]){ | ||
+ | b[0] = 0; | ||
+ | act1(); | ||
+ | }else if(a[4]){ | ||
+ | b[0] = 0; | ||
+ | act4(); | ||
+ | }else if(a[2]){ | ||
+ | b[0] = 0; | ||
+ | act2(); | ||
+ | } | ||
+ | } | ||
+ | //rep(i,0,4) show1(a[i]); | ||
+ | //rep(i,0,4) show1(b[i]); | ||
+ | if(win()) cout<<"Yes"<<endl; | ||
+ | else cout<<"No"<<endl; | ||
+ | } | ||
+ | return 0; | ||
+ | } | ||
+ | </code> </hidden> | ||
+ | \\ | ||
==== E - Game ==== | ==== E - Game ==== | ||