真心送分题。
没救了。
以后写题之前一定好好想想这样做对不对。
分情况讨论。
Bob手里有至少一张比Alice所有牌都小的牌
由于Alice不傻,它一定会把除了这张牌之外的牌全扔掉,最后赢了。
Bob手里不存在一张比Alice手里所有牌都小的牌,但是存在至少一张不大于Alice手里任何牌的牌
除非Bob傻,否则Alice现在一定赢不了了。
但是Alice可以把除了这张牌之外的牌全部扔掉,Bob也会把比这张牌大的牌(如果存在的话)扔掉,得到平局
除此之外的情况
Bob赢了。
#include <algorithm>
#include <cstring>
#include <iostream>
#include <set>
#include <utility>
using pair_t = std::pair<int, int>;
using int_t = long long int;
using std::cin;
using std::cout;
using std::endl;
pair_t rev(pair_t x) { return pair_t(x.second, x.first); }
std::ostream& operator<<(std::ostream& os, pair_t x) {
os << "{" << x.first << "," << x.second << "}";
return os;
}
const int_t LARGE = 2e5;
const char* process() {
static int_t deg[2][LARGE + 1];
memset(deg, 0, sizeof(deg));
int_t n, m;
scanf("%lld%lld", &n, &m);
for (int_t i = 1; i <= m; i++) {
int_t a, b;
char buf[5];
scanf("%lld%s%lld", &a, buf, &b);
if (buf[0] == '<')
deg[1][b]++;
else
deg[0][b]++;
}
for (int_t i = 1; i <= n; i++)
if (deg[0][i] == n) return "Alice";
for (int_t i = 1; i <= n; i++)
if (deg[1][i] == 0) return "Draw";
return "Bob";
// return "";
}
int main() {
int_t T;
cin >> T;
while (T--) cout << process() << endl;
return 0;
}
发表回复