链接: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.

输入描述:

  1. The input consists of multiple test cases.
  2.  
  3. 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

  1. . The input guarantees that each of the n strings must be a non-empty substring of t.
  2.  
  3. The total length of all strings will not exceed 30000000.

输出描述:

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

输入例子:
  1. aaaa
  2. 1
  3. a
  4. abcabd
  5. 1
  6. a
输出例子:
  1. Alice
  2. Bob

-->

示例1

输入

  1. aaaa
  2. 1
  3. a
  4. abcabd
  5. 1
  6. a

输出

  1. Alice
  2. 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. Python +selenium之设置元素等待

    注:本文转载http://www.cnblogs.com/mengyu/p/6972968.html 当浏览器在加载页面时,页面上的元素可能并不是同时被加载完成,这给元素的定位增加了困难.如果因为在加 ...

  2. 日常-acm-三位数反转

    输入一个三位数,分理出它的百位,十位和个位,反转后输出. 样例输入: 127 样例输出: 721 tips:注意最后一位为0的情况,如360,输出063 #include <iostream&g ...

  3. Netbackup驱动器常用命令vmoprcmd

    1.vmoprcmd vmoprcmd – 对驱动器执行操作员功能 大纲 vmoprcmd -devmon [pr | ds | hs] [-h device_host] default_operat ...

  4. FreeRTOS笔记

    任务的创建和删除(静态方法) 任务创建后要开启调度器. FreeRTOSConfig.h 1. 改宏 使能静态创建函数. 会出现,有两个函数未定义. Cortex-M中断管理(上) NVIC:嵌套向量 ...

  5. 苹果市值破万亿,iPhone 会涨价吗?

    今日导读 苹果教父乔布斯曾经说过:“活着就是为了改变世界.”虽然他在 56 岁时就遗憾离世,但他极具创新和变革的精神早已深埋进苹果公司的企业文化里,影响着一代又一代的人.就在最近,这家一直努力“改变世 ...

  6. 【转】实用API大全

    有道翻译APIhttp://fanyi.youdao.com/openapi有道翻译API支持中英互译,同时获得有道翻译结果和有道词典结果(可能没有),返回格式为XML或JSON. 百度翻译APIht ...

  7. Java删除开头和末尾字符串

    //扩展2个String方法 /* * 删除开头字符串 */ public static String trimstart(String inStr, String prefix) { if (inS ...

  8. C++ NULL与nullptr的区别

    C与C++中空指针的区别 在C里面,由于处处都要使用指针,所以导致NULL遍布各地.我们先来看C99是怎么定义NULL的: NULL can be defined as any null pointe ...

  9. 瀑布流封装(仿写UITableView)

    本篇文章将会仿照苹果系统提供的UITableView类,封装一个瀑布流效果的控件!!! 该控件和系统的UITableView是相同级别的 (继承自系统的UIScrollView) GitHub中Dem ...

  10. 使用CAShapeLayer实现复杂的View的遮罩效果

    一.案例演示 最近在整理一个聊天的项目的时候,发送图片的时候,会有一个三角的指向效果,指向这张图片的发送者.服务端返回给我们的图片只是一张矩形的图片,我们如何把一张矩形的图片或者View,加上一层自定 ...