链接: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. Google Play发布App中遇到"多个APK:版本1未提供给任何设备配置使用。"问题的解决方法

    在google play上发布apk,当上传了apk文件,填写了相关的内容信息和介绍图片.图标后,出现“发布应用”始终灰色无法点击,查看原因显示如下问题: 其中支持的设备数量始终显示为0,怀疑是编译出 ...

  2. java代码关闭tomcat程序

    1.通过java代码实现tomcat的关闭 2.tomcatStop.java package test; import java.io.BufferedReader; import java.io. ...

  3. 洛谷 P1057 传球游戏

    题目描述 上体育课的时候,小蛮的老师经常带着同学们一起做游戏.这次,老师带着同学们一起做传球游戏. 游戏规则是这样的:n个同学站成一个圆圈,其中的一个同学手里拿着一个球,当老师吹哨子时开始传球,每个同 ...

  4. Vector 容器简单介绍

    # Vector STL简要介绍 关于STL中的vector容器,以下做一些相关介绍. #### vector 简要概述 vector 称作向量类,属于容器类,实现了动态的数组,用于元素数量变化的对象 ...

  5. python基础一 day15 面试题

    # def demo():# for i in range(4):# yield i## g=demo()## g1=(i for i in g)# g2=(i for i in g1)## prin ...

  6. 2018.5.7 androidStudio中:layout_gravity 与 gravity的属性的区别

    android:gravity:设置的是控件自身上面的内容位置 android:layout_gravity:设置控件本身相对于父控件的显示位置. 看下面 <LinearLayout xmlns ...

  7. 《毛毛虫组》【Alpha】Scrum meeting 3

    第二天 日期:2019/6/16 1.1 今日完成任务情况以及遇到的问题. 今日完成任务情况: 货物入库管理模块设计: (1)对数据库表--tb_InStore进行修改并完善: (2)学习SQL Se ...

  8. Forbidden You don't have permission to access /phpStudyTest/application/index/controller/Index.php on this server.

    发生情况:将thinkPHP从官网上下了  http://thinkphp.cn 然后安装了phpstudy和PHPstorm,并将thinkPHP解压到www路径下 在用PHPstorm打开 thi ...

  9. Core BlueTooth官方文档翻译

    本⽂文是苹果<Core Bluetooth Programming Guide>的翻译. 关于Core Bluetooth Core Bluetooth 框架提供了蓝⽛牙低功耗⽆无线设备与 ...

  10. (2) html 语义化

    HTML语义化标签 1 什么是语义化标签? 通过标签判断内容语义,例如根据h1标签判断出内容是标题,根据 p 判断内容是段落.input 标签是输入框等. 2 为什么要标签语义化? 1.搜素引擎友好 ...