链接:https://www.nowcoder.com/acm/contest/92/A
来源:牛客网

AStringGame
时间限制:C/C++ 2秒,其他语言4秒
空间限制:C/C++ 262144K,其他语言524288K
64bit IO Format: %lld

题目描述

Recently Alice and Bob are playing a game about strings. Before starting the game, they should prepare n strings s1, s2, ..., sn and a target string t. It's promised that each of these n strings is a substring of t.

When the game begins, they do the following things alternately while Alice starts first:

  • Choose a string si from the n strings;
  • Append one letter to the chosen string;
  • The new string must also be a substring of t.

If the above things cannot be completed, the player loses the game. Suppose Alice and Bob both use optimal strategy, find who will win the game.

输入描述:

The input consists of multiple test cases.

Each test case begins with the non-empty target string t, whose length will not exceed 100000. The second line contains an integer n (1 ≤ n ≤ 100), the number of strings they prepared. Then n lines follow. The i-th line of the following n lines is the string s

i

. The input guarantees that each of the n strings must be a non-empty substring of t.

The total length of all strings will not exceed 30000000.

输出描述:

For each test case, output the winner "Alice" or "Bob" (without quotes) in one line.

输入例子:
aaaa
1
a
abcabd
1
a
输出例子:
Alice
Bob

-->

示例1

输入

aaaa
1
a
abcabd
1
a

输出

Alice
Bob

听说要sa要做sg函数

看一看学习学习

是男人就过 8 题--Pony.AI A AStringGame的更多相关文章

  1. [是男人就过8题——Pony.ai]Perfect N-P Arrays

    [是男人就过8题--Pony.ai]Perfect N-P Arrays 题目大意: 一棵\(n(\sum n\le5\times10^6)\)个结点的树,每个结点都有一个括号.求树上一个合法的括号序 ...

  2. 【计蒜客】是男人就过 8 题--Pony.AI 题 A. A String Game 后缀自动机+SG函数

    [题目]A. A String Game [题意]给定目标串S和n个子串Ti,Alice和Bob轮流选择一个子串操作,必须且只能在子串末尾添加一个字符使得新串也是S的子串,不能操作即输,求胜利者.|S ...

  3. 是男人就过八题A_A String Game题解

    题意 给一个字符串\(s\),和\(n\)个子串\(t[i]\),两个人博弈,每次取出一个串\(t[i]\),在后面加入一个字符,保证新字符串仍然是\(s\)的子串,无法操作的人输. 分析 n个子串, ...

  4. 【HDU 5532 Almost Sorted Array】水题,模拟

    给出一个序列(长度>=2),问去掉一个元素后是否能成为单调不降序列或单调不增序列. 对任一序列,先假设其可改造为单调不降序列,若成立则输出YES,不成立再假设其可改造为单调不增序列,若成立则输出 ...

  5. POJ 1741 Tree(树的点分治,入门题)

    Tree Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 21357   Accepted: 7006 Description ...

  6. 警告!中国90%AI初创企业将在两年内落败出局

    https://mp.weixin.qq.com/s/-RkyLda1jovaHBlBTsi-BA 近年来,中国涌现了一大批AI初创企业,但AI热潮也伴随着泡沫.由于近期市场资金紧缩,投资者发出警告, ...

  7. AI Conference 2018人工智能大会 参会总结

    主 题:AI Conference 2018人工智能大会 时 间:2018.04.11-4.13 地 点:北京国际饭店会议中心 发起人:O'Reilly 和 Intel 参与部门:研发设计部 参会人员 ...

  8. zzPony.ai 的基础架构挑战与实践

    本次分享将从以下几个方面介绍: Pony.ai 基础架构做什么 车载系统 仿真平台 数据基础架构 其他基础架构 1. Pony.ai 基础架构 首先给大家介绍一下 Pony.ai 的基础架构团队做什么 ...

  9. 全球百大最有前景AI公司出炉,中国成独角兽最强诞生地

    https://new.qq.com/omn/20190210/20190210B0BVK2.html 硅谷最强智库之一的 CB Insights 日前发布 AI 100 2019 报告,在这 100 ...

随机推荐

  1. EasyUI Tabs + Yii2.0实现iframe方式打开页面(解决共用静态文件引入加载的问题)

    在项目实际开发中,有将打开的各个链接页面隔离的需求(防止静态资源起冲突),这个时候常规思路就是使用iframe来实现!但遇到一个比较棘手的问题,当用easyui Tabs打开一个iframe页面时,怎 ...

  2. SharePoint运行状况分析器有关磁盘空间不足的警告

    对于负责管理SharePoint内部部署安装的SharePoint管理员,SharePoint Health Analyzer是一款出色的工具.此功能不仅有助于解决服务器故障和服务失败的问题,还提供了 ...

  3. Python +selenium之集成测试报告与unittest单元测试

    随着软件不断迭代,对应的功能也会越来越多,从而对应的测试用例也会呈指数增长.如果将全部的测试用例集成在一个文件中就会显得特别的臃肿而且维护成本也会很高. 一个很好的放大就是将这些测试yo你给里按照功能 ...

  4. 洛谷 P2691 逃离

    题目描述 一个n×n栅格是由n行和n列顶点组成的一个无向图,如图所示.用(i,j)表示处于第i行第j列的顶点.除了边界顶点(即满足i=1,i=n,j=1或j=n的顶点(i,j)),栅格中的所有其他顶点 ...

  5. Spark Job调优(Part 2)

    原文链接:https://wongxingjun.github.io/2016/05/11/Spark-Job%E8%B0%83%E4%BC%98-Part-2/ 这篇文章将会完成Part 1中留下的 ...

  6. Python-OpenCV——Image inverting

    通常我们将读入的彩色图转化成灰度图,需要将灰度图反转得到掩码,如何正确快速的得到某个图像的反转图呢? 首先看一种看似很正确的写法,对其中每个像素进行如下处理: img[x,y] = abs(img[x ...

  7. Memcache使用基础

    Memcached的特点:     协议简单     基于libevent的事件处理     内置内存存储方式     memcached不互相通信的分布式   1.协议简单:     使用简单的基于 ...

  8. php的字符转换 & php登入注册界面设计以及源码 & 分离公共部分

    我们在编写的时候总是会出现乱码 https://www.cnblogs.com/mafeng/p/5827215.html php登入注册界面设计以及源码 https://blog.csdn.net/ ...

  9. LINQ与反射

    string file = @"C:\Windows\winsxs\x86_netfx35linq-system.core_31bf3856ad364e35_6.1.7601.17514_n ...

  10. Codeforces 517 #B

    http://codeforces.com/contest/1072/problem/B 开始想的只有搜索,时间复杂度$O(4^n)$,明显有问题. 想了半个小时没有思路,然后想到了正难则反,就开始步 ...